From 049f72dea66998d621b353be591ae9bd298b58ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Katzer?= Date: Tue, 26 Jul 2016 20:44:10 +0200 Subject: [PATCH] Fix potential NPE --- src/android/Printer.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/android/Printer.java b/src/android/Printer.java index ca7d542..0df5f68 100644 --- a/src/android/Printer.java +++ b/src/android/Printer.java @@ -23,6 +23,7 @@ package de.appplant.cordova.plugin.printer; import android.app.Activity; import android.content.Context; +import android.content.Intent; import android.os.Build; import android.print.PrintAttributes; import android.print.PrintDocumentAdapter; @@ -252,13 +253,16 @@ public class Printer extends CordovaPlugin { */ @Override public void onResume (boolean multitasking) { + super.onResume(multitasking); + + if (job == null || command == null) + return; + PluginResult res = new PluginResult( PluginResult.Status.OK, job.isStarted() || job.isCompleted()); job = null; command.sendPluginResult(res); - - super.onResume(multitasking); } /**