onryldz / x-superobject

Delphi Cross Platform Rapid JSON
316 stars 118 forks source link

c0000005 ACCESS_VIOLATION when AsFloat in array is "0" #75

Closed Darkster1 closed 9 years ago

Darkster1 commented 9 years ago

Hi there,

I get an access violation error when I try this code:

State_xy_X := JSO['action.xy[0]'].AsFloat; // X State_xy_Y := JSO['action.xy[1]'].AsFloat; // Y On this REST result from Philips HUE. Usually there are values like 0.4321,0.8765 in the XY array but sometimes just "0" is returned.

{"name":"Schedule test","lights":["7","8"],"type":"LightGroup","action":{"on":false,"bri":254,"hue":2548,"sat":254,"effect":"none","xy":[0,0],"ct":153,"alert":"none","colormode":"ct"}}

Is this a "bug" or should I use a different approach?

Using the latest XSuperObject files and Delphi XE10 Seattle (but in XE8 I had the same issue, wrapped a try, except arround it for the time being).