From 08593c69437930855aefcb28d72772726947970a Mon Sep 17 00:00:00 2001 From: Glenn Washburn Date: Sat, 30 Mar 2024 03:43:05 -0400 Subject: [PATCH] Fix NaN values in MCU when clicking "Set DC" while no value is in custom input box --- JPEGVisualRepairTool.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/JPEGVisualRepairTool.html b/JPEGVisualRepairTool.html index d097d8f..bc2d387 100644 --- a/JPEGVisualRepairTool.html +++ b/JPEGVisualRepairTool.html @@ -891,7 +891,10 @@

JPEG visual repair tool v1.3 (Oct '23)

by Albert undoList.push({action: "DC", position: selectedMCU.i, cell: structuredClone(MCUarray[selectedMCU.i])}); if(value==0){ var newDC=parseInt(document.getElementById("dcVal").value); - if(document.getElementById("layer").value=="Y"){ + if (Number.isNaN(parseInt(newDC))) { + ; // no value or invalid value + } + else if(document.getElementById("layer").value=="Y"){ MCUarray[selectedMCU.i].blocks[0].coeff[0]=newDC; } else if(document.getElementById("layer").value=="C1"){