Disable utf8 display when impossible to decode

This commit is contained in:
Willian Mitsuda 2021-11-08 14:55:41 -03:00
parent d905afd75d
commit 05aee02a43
1 changed files with 3 additions and 4 deletions

View File

@ -30,9 +30,8 @@ const InputDecoder: React.FC<InputDecoderProps> = ({
try {
return toUtf8String(data);
} catch (err) {
console.warn("Error while converting input data to string");
console.warn(err);
return "<can't decode>";
// Silently ignore on purpose
return undefined;
}
}, [data]);
@ -41,7 +40,7 @@ const InputDecoder: React.FC<InputDecoderProps> = ({
<Tab.List className="flex space-x-1 mb-1">
<ModeTab disabled={!resolvedTxDesc}>Decoded</ModeTab>
<ModeTab>Raw</ModeTab>
<ModeTab>UTF-8</ModeTab>
<ModeTab disabled={utfInput === undefined}>UTF-8</ModeTab>
</Tab.List>
<Tab.Panels>
<Tab.Panel>