Преглед на файлове

DesignDemo: do not crash, if response to /action/... in not json / skips callback as then there is no data

martin преди 4 години
родител
ревизия
36cb79dfb3
променени са 1 файла, в които са добавени 2 реда и са изтрити 3 реда
  1. 2 3
      demo/webwidget/designdemo/webideclient.pp

+ 2 - 3
demo/webwidget/designdemo/webideclient.pp

@@ -78,13 +78,12 @@ Var
   aActionPayload : TJSObject;
 
 begin
-  if (aCode div 100)=2 then
+  if ((aCode div 100)=2) and Assigned(aPayload) and Assigned(OnActionResponse) then
     begin
     aID:=NativeInt(aPayLoad['id']);
     aName:=String(aPayLoad['name']);
     aActionPayLoad:=TJSObject(aPayLoad['payload']);
-    If Assigned(OnActionResponse) then
-      OnActionResponse(Self,aID,aName,aActionPayload);
+    OnActionResponse(Self,aID,aName,aActionPayload);
     end;
 end;