null check if value is null before trying to convert into jtoken fixes #210

This commit is contained in:
Avi Romascanu
2014-02-09 19:24:52 +02:00
parent 71a91bf34f
commit 2368a8e1b1
2 changed files with 24 additions and 1 deletions
@@ -482,7 +482,7 @@ namespace Newtonsoft.Json.Serialization
// convert object value to JToken so it is compatible with dictionary
// could happen because of primitive types, type name handling and references
if (isJTokenValueType && !(value is JToken))
if (isJTokenValueType && !(value is JToken) && value!=null)
value = JToken.FromObject(value);
setExtensionDataDictionaryValue(dictionary, key, value);