Skip to content

Commit ef0b0aa

Browse files
masmoomythos
authored andcommitted
npe fix
1 parent 96a2392 commit ef0b0aa

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

16/SensorDemos/src/com/oreilly/demo/pa/ch16/NFC233.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ private void writeTag() {
185185
}
186186

187187
final Ndef ndefref = Ndef.get(mytag);
188+
189+
if(ndefref == null) {
190+
Toast.makeText(this, "Tag is not Ndef: NULL", Toast.LENGTH_SHORT).show();
191+
return;
192+
}
188193

189194
if(!ndefref.isWritable()) {
190195
Toast.makeText(this, "The tag is not writable!", Toast.LENGTH_SHORT).show();

0 commit comments

Comments
 (0)