Closed vanillamasonry closed 3 years ago
Thanks for reporting this issue! Unfortunately, your workaround didn't fixed the issue. It could return invalid data when requesting the value later, and also result in a memory leak. A added a fix that should solve the issue. It works in my tests. Feel free to reopen this issue if it doesn't work for you.
Hi,
There is a problem Neslib.Json.pas on Linux, Android, and other platforms except Windows
The following lines will raise an Assertion Failed Error (line 1280 - Assert((UIntPtr(P) and TYPE_MASK) = 0); )
FJSONData:=TJsonDocument.CreateDictionary; FJSONData.Root.AddOrSetValue('data','0'); <- will raise ASSERTION ERROR only if the VALUE IS one character long ON Android, Linux ... EXCEPT Windows
and in Neslib.Json
class function TJsonValue.Create(const AValue: JsonString): TJsonValue; var P: Pointer; begin P := nil; JsonString(P) := AValue; // Increases ref count Assert((UIntPtr(P) and TYPE_MASK) = 0); <- here Result.FBits := TYPE_STR or UIntPtr(P); end;
NOTE:
(Workaround)
Thank you, Paul