From 2d9a54bc0e65b54a47162410d70e63df0eaee2b7 Mon Sep 17 00:00:00 2001 From: seven332 Date: Mon, 15 Sep 2014 15:09:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20onStartCommand=20=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E7=9A=84=20NullPointerException?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/hippo/ehviewer/service/DownloadService.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/com/hippo/ehviewer/service/DownloadService.java b/src/com/hippo/ehviewer/service/DownloadService.java index 1108ebb11..e32f33dd6 100644 --- a/src/com/hippo/ehviewer/service/DownloadService.java +++ b/src/com/hippo/ehviewer/service/DownloadService.java @@ -68,8 +68,9 @@ public class DownloadService extends Service getSystemService(Context.NOTIFICATION_SERVICE); } - @Override - public int onStartCommand(Intent intent, int flags, int startId) { + private void handleIntent(Intent intent) { + if (intent == null) + return; if (ACTION_STOP.equals(intent.getAction())) { stopCurrentTask(); @@ -78,6 +79,12 @@ public class DownloadService extends Service stopAll(); mNotifyManager.cancel(DOWNLOAD_NOTIFY_ID); } + } + + @Override + public int onStartCommand(Intent intent, int flags, int startId) { + + handleIntent(intent); return START_NOT_STICKY; }