Skip to content

Conversation

@nzagorchev
Copy link
Contributor

What Where/Who
JIRA Issue SDK-396

Background

If Decryption fails, String.Empty is returned. This cannot be parsed by MiniJSON and throws an exception.
Such exception can be thrown in VarCache.LoadDiffs when calling ApplyVariableDiffs.

Implementation

Return null for String.Empty when parsing JSON.

Testing steps

var test = LeanplumSDK.MiniJSON.Json.Deserialize("");

The above line was previously throwing an exception:

OverflowException: Value was either too large or too small for a character.
at System.Convert.ToChar (System.Int32 value)

It now returns null.

Other cases remain unchanged:

var test = LeanplumSDK.MiniJSON.Json.Deserialize(" "); // returns null
var test = LeanplumSDK.MiniJSON.Json.Deserialize("  "); // returns null

Is this change backwards-compatible?

Yes

@nzagorchev nzagorchev requested a review from milos1290 June 3, 2021 21:21
@nzagorchev nzagorchev merged commit 815f1f0 into master Jun 11, 2021
@delete-merged-branch delete-merged-branch bot deleted the parse-fix branch June 11, 2021 09:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants