瀏覽代碼

Fix JSON parsing error when record.other is empty string

Lilo 1 年之前
父節點
當前提交
f7277933d4
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      web/src/components/LogsTable.js

+ 6 - 1
web/src/components/LogsTable.js

@@ -236,7 +236,12 @@ const LogsTable = () => {
               </>
             );
          } else {
-           let other = JSON.parse(record.other);
+           let other = null;
+           try {
+             other = JSON.parse(record.other);
+           } catch (e) {
+             console.error(`Failed to parse record.other: "${record.other}".`, e);
+           }
            if (other === null) {
              return <></>;
            }