mirror of
https://github.com/greenshot/greenshot
synced 2025-08-19 13:10:00 -07:00
Fixed optimize error.
This commit is contained in:
parent
610f45d082
commit
4ff0f090bb
1 changed files with 8 additions and 3 deletions
|
@ -140,8 +140,13 @@ namespace Greenshot.IniFile {
|
||||||
public Type ValueType {
|
public Type ValueType {
|
||||||
get {
|
get {
|
||||||
var valueType = _propertyInfo?.PropertyType ?? _fieldInfo.FieldType;
|
var valueType = _propertyInfo?.PropertyType ?? _fieldInfo.FieldType;
|
||||||
|
if (!valueType.IsGenericType)
|
||||||
|
{
|
||||||
|
return valueType;
|
||||||
|
}
|
||||||
var genericTypeDefinition = valueType.GetGenericTypeDefinition();
|
var genericTypeDefinition = valueType.GetGenericTypeDefinition();
|
||||||
if (genericTypeDefinition != null && (valueType.IsGenericType && genericTypeDefinition == typeof(Nullable<>))) {
|
if (genericTypeDefinition != null && genericTypeDefinition == typeof(Nullable<>))
|
||||||
|
{
|
||||||
// We are dealing with a generic type that is nullable
|
// We are dealing with a generic type that is nullable
|
||||||
valueType = Nullable.GetUnderlyingType(valueType);
|
valueType = Nullable.GetUnderlyingType(valueType);
|
||||||
}
|
}
|
||||||
|
@ -286,8 +291,8 @@ namespace Greenshot.IniFile {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else if (!string.IsNullOrEmpty(propertyValue)) {
|
} else if (!string.IsNullOrEmpty(propertyValue)) {
|
||||||
var genericTypeDefinition = valueType.GetGenericTypeDefinition();
|
if (valueType.IsGenericType && valueType.GetGenericTypeDefinition() == typeof(Nullable<>))
|
||||||
if (genericTypeDefinition != null && (valueType.IsGenericType && genericTypeDefinition == typeof(Nullable<>))) {
|
{
|
||||||
// We are dealing with a generic type that is nullable
|
// We are dealing with a generic type that is nullable
|
||||||
valueType = Nullable.GetUnderlyingType(valueType);
|
valueType = Nullable.GetUnderlyingType(valueType);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue