Skip to content

Commit 2eab14c

Browse files
committed
Only call Parse() methods on value types (structs)
1 parent 71fb7c6 commit 2eab14c

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/ServiceStack.Text/Common/JsReader.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,9 +84,11 @@ public ParseStringDelegate GetParseFn<T>()
8484
if (parseFn != null) return parseFn;
8585
}
8686

87-
var staticParseMethod = StaticParseMethod<T>.Parse;
88-
if (staticParseMethod != null)
89-
return value => staticParseMethod(Serializer.ParseRawString(value));
87+
if (type.IsValueType) {
88+
var staticParseMethod = StaticParseMethod<T>.Parse;
89+
if (staticParseMethod != null)
90+
return value => staticParseMethod(Serializer.ParseRawString(value));
91+
}
9092

9193
var typeConstructor = DeserializeType<TSerializer>.GetParseMethod(TypeConfig<T>.GetState());
9294
if (typeConstructor != null)

0 commit comments

Comments
 (0)