Skip to content

Commit 4e2b5e4

Browse files
authored
Merge pull request #9098 from wordpress-mobile/fix/uploader-service-crash
PostUploader service: moved initialization of helper classes to onCreate()
2 parents dc3beea + 94d6ab8 commit 4e2b5e4

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

WordPress/src/main/java/org/wordpress/android/ui/uploads/UploadService.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,18 @@ public void onCreate() {
8787
mDispatcher.register(this);
8888
sInstance = this;
8989
// TODO: Recover any posts/media uploads that were interrupted by the service being stopped
90+
91+
if (mMediaUploadHandler == null) {
92+
mMediaUploadHandler = new MediaUploadHandler();
93+
}
94+
95+
if (mPostUploadNotifier == null) {
96+
mPostUploadNotifier = new PostUploadNotifier(getApplicationContext(), this);
97+
}
98+
99+
if (mPostUploadHandler == null) {
100+
mPostUploadHandler = new PostUploadHandler(mPostUploadNotifier);
101+
}
90102
}
91103

92104
@Override
@@ -128,18 +140,6 @@ public int onStartCommand(Intent intent, int flags, int startId) {
128140
return START_NOT_STICKY;
129141
}
130142

131-
if (mMediaUploadHandler == null) {
132-
mMediaUploadHandler = new MediaUploadHandler();
133-
}
134-
135-
if (mPostUploadNotifier == null) {
136-
mPostUploadNotifier = new PostUploadNotifier(getApplicationContext(), this);
137-
}
138-
139-
if (mPostUploadHandler == null) {
140-
mPostUploadHandler = new PostUploadHandler(mPostUploadNotifier);
141-
}
142-
143143
if (intent.hasExtra(KEY_MEDIA_LIST)) {
144144
unpackMediaIntent(intent);
145145
}

0 commit comments

Comments
 (0)