From f0f202357b42b2237394879c44e1f5723d05a1ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Guilherme=20Arthur=20Ger=C3=B4nimo?=
 <guilherme.geronimo@ufsc.br>
Date: Wed, 22 Nov 2023 00:40:51 +0000
Subject: [PATCH] Fixing #5

---
 bin/smartdata/Backend.php | 2 +-
 bin/smartdata/Series.php  | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/bin/smartdata/Backend.php b/bin/smartdata/Backend.php
index b2a0300..36ad75a 100644
--- a/bin/smartdata/Backend.php
+++ b/bin/smartdata/Backend.php
@@ -3145,7 +3145,7 @@ class Backend_V1_1 extends Backend_Common
                     }
                     if($is_digital and ($series->type != 'TTH')){
                         $value_blob = $entry->get('value')->toBinaryString();
-                        switch ($type) {
+                        switch ($series->type) {
                             case Unit::I32:
                                 $value = Unpack::uInt32($value_blob);
                                 break;
diff --git a/bin/smartdata/Series.php b/bin/smartdata/Series.php
index 54a9135..f8e2cb1 100644
--- a/bin/smartdata/Series.php
+++ b/bin/smartdata/Series.php
@@ -183,9 +183,9 @@ class Series
       $sd   = new self(
                 $json->version,
                 $json->unit??0,
-                $json->x,
-                $json->y,
-                $json->z,
+                $json->x ?? 0,
+                $json->y ?? 0,
+                $json->z ?? 0,
                 $json->r ?? 0,
                 $json->t0 ?? 0,
                 $json->t1 ?? ($json->tf ?? 0),
-- 
GitLab