Fix saving of storage variable

This commit is contained in:
Manuel Thalmann 2023-10-13 02:29:28 +02:00
parent 9c8555d695
commit f293664f80

View file

@ -21,7 +21,7 @@ import static hwb1.MyAppletStrings.*;
// Insert your strings here // Insert your strings here
name = "MyAppletStrings") name = "MyAppletStrings")
public class MyApplet extends Applet { public class MyApplet extends Applet {
private byte[] storage = null; private byte[] storage = new byte[] {};
/** /**
* Installs this applet. * Installs this applet.
@ -79,6 +79,7 @@ public class MyApplet extends Applet {
break; break;
case 0x02: case 0x02:
length = apdu.setIncomingAndReceive(); length = apdu.setIncomingAndReceive();
storage = new byte[length];
if (length > 20) { if (length > 20) {
ISOException.throwIt(ISO7816.SW_WRONG_LENGTH); ISOException.throwIt(ISO7816.SW_WRONG_LENGTH);