Fix potential NPE

This commit is contained in:
Sebastián Katzer 2016-07-26 20:44:10 +02:00
parent b3bd6e226f
commit 049f72dea6

View File

@ -23,6 +23,7 @@ package de.appplant.cordova.plugin.printer;
import android.app.Activity; import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.os.Build; import android.os.Build;
import android.print.PrintAttributes; import android.print.PrintAttributes;
import android.print.PrintDocumentAdapter; import android.print.PrintDocumentAdapter;
@ -252,13 +253,16 @@ public class Printer extends CordovaPlugin {
*/ */
@Override @Override
public void onResume (boolean multitasking) { public void onResume (boolean multitasking) {
super.onResume(multitasking);
if (job == null || command == null)
return;
PluginResult res = new PluginResult( PluginResult res = new PluginResult(
PluginResult.Status.OK, job.isStarted() || job.isCompleted()); PluginResult.Status.OK, job.isStarted() || job.isCompleted());
job = null; job = null;
command.sendPluginResult(res); command.sendPluginResult(res);
super.onResume(multitasking);
} }
/** /**