Skip to content

Commit 049dca6

Browse files
fix: handle users with no subscription
1 parent 516b410 commit 049dca6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

utils/http/http.simba

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,10 +328,14 @@ var
328328
begin
329329
jsonArray := Self.Select('profiles', 'subscription', 'id,date_start,date_end', ['id=eq.' + Self.User.ID]);
330330

331+
if jsonArray.length = 0 then exit();
332+
331333
for i := 0 to jsonArray.High() do
332334
begin
333335
with jsonArray.getJSONObject(i) do
334336
begin
337+
if not Has('product') then continue;
338+
335339
sub.Product := getString('product');
336340
sub.DateStart := getString('date_start');
337341
sub.DateEnd := getString('date_end');
@@ -357,10 +361,14 @@ var
357361
begin
358362
jsonArray := Self.Select('profiles', 'free_access', '*', ['id=eq.' + Self.User.ID]);
359363

364+
if jsonArray.length = 0 then exit();
365+
360366
for i := 0 to jsonArray.High() do
361367
begin
362368
with jsonArray.getJSONObject(i) do
363369
begin
370+
if not Has('product') then continue;
371+
364372
sub.Product := getString('product');
365373
sub.DateStart := getString('date_start');
366374
sub.DateEnd := getString('date_end');

0 commit comments

Comments
 (0)