From 097ea67a9976bd3c5363c47d8082f96fb28654fa Mon Sep 17 00:00:00 2001
From: Phoomparin Mano <phoomparin@gmail.com>
Date: Tue, 19 Dec 2023 08:55:32 +0700
Subject: [PATCH] fix: edge case where null terminator is not present

---
 canvas/src/blocks/value-view/components/ValueRenderer.tsx | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/canvas/src/blocks/value-view/components/ValueRenderer.tsx b/canvas/src/blocks/value-view/components/ValueRenderer.tsx
index b0e4e58..7bd75d2 100644
--- a/canvas/src/blocks/value-view/components/ValueRenderer.tsx
+++ b/canvas/src/blocks/value-view/components/ValueRenderer.tsx
@@ -87,7 +87,8 @@ export const ValueRenderer = memo((props: ValueRendererProps) => {
 
     case "String": {
       // do not read after null terminator (\0)
-      const end = values.findIndex((x) => x === 0)
+      let end = values.findIndex((x) => x === 0)
+      if (end === -1) end = values.length
 
       const text = values
         .slice(0, end)