From 33fa5384aa7673cac64d6895a9564caa23a08881 Mon Sep 17 00:00:00 2001 From: lewix <> Date: Fri, 31 Jan 2020 11:02:46 +0100 Subject: [PATCH] minor fix --- src/react-engine/ApduForm.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/react-engine/ApduForm.tsx b/src/react-engine/ApduForm.tsx index 01a3e4c..233cad9 100644 --- a/src/react-engine/ApduForm.tsx +++ b/src/react-engine/ApduForm.tsx @@ -129,7 +129,7 @@ export class ApduForm extends React.Component { private onBlurApduField(event: React.FormEvent) { - const newHexString: string = Utilities.bytesToHexString([parseInt(event.currentTarget.value, 16)]).toUpperCase(); + const newHexString: string = Utilities.bytesToHexString([parseInt(event.currentTarget.value === "" ? "00" : event.currentTarget.value, 16)]).toUpperCase(); const apduToUpdate: IApduFormState = { ...this.state }; switch (event.currentTarget.name) { @@ -220,6 +220,7 @@ export class ApduForm extends React.Component { * macOS workaround (but found in windows too) * https://ludovicrousseau.blogspot.com/2017/03/macos-sierra-bug-scardtransmit-silently.html */ + const originalLe: number = parseInt(this.state.apduToSend.le, 16); [apduResult, err] = await CardManager.sendApdu( { Cla: parseInt(this.state.apduToSend.cla, 16), @@ -232,6 +233,7 @@ export class ApduForm extends React.Component { }, Utilities.hexStringToBytes(this.state.apduToSend.dataIn), ); + apduResult.Data = apduResult.Data.slice(0, originalLe); } } const apduToUpdate: IApduFormState = { ...this.state };