GetJSON (from unit fpjson) doesn't raise exception
- Lazarus/FPC Version: Lazarus 4.99 (rev main_4_99-3327-g7ac8a29b00) FPC 3.3.1 x86_64-win64-win32/win64
- Operating System: Windows 11
- CPU / Bitness: 64
What happens
When passed empty string, GetJSON doesn't raise exception, it returns nil instead.
What did you expect
I expect it to raise exception (per documentation : 'An exception will be raised if the JSON data stream does not contain valid JSON data.'). Empty string is not valid JSON.
Steps to reproduce
uses SysUtils, fpjson, jsonparser;
var j: TJsonData;
begin
try
j := GetJSON('');
If j = nil then
WriteLn('Should have exception.');
except
WriteLn('Exception.');
end;
end.
Edited by Maxim Ganetsky