Skip to content

Commit

Permalink
minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
lewix committed Jan 31, 2020
1 parent e70d6f9 commit 33fa538
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/react-engine/ApduForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export class ApduForm extends React.Component<IApduFormProps, IApduFormState> {

private onBlurApduField(event: React.FormEvent<HTMLInputElement>) {

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) {
Expand Down Expand Up @@ -220,6 +220,7 @@ export class ApduForm extends React.Component<IApduFormProps, IApduFormState> {
* 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),
Expand All @@ -232,6 +233,7 @@ export class ApduForm extends React.Component<IApduFormProps, IApduFormState> {
},
Utilities.hexStringToBytes(this.state.apduToSend.dataIn),
);
apduResult.Data = apduResult.Data.slice(0, originalLe);
}
}
const apduToUpdate: IApduFormState = { ...this.state };
Expand Down

0 comments on commit 33fa538

Please sign in to comment.