packages/apps/CMFileManager
Revision | 901e396ccac70ae23a9b2a95ed83387909af1e5e (tree) |
---|---|
Time | 2016-01-26 03:25:16 |
Author | Abhishek Gilra <agilra@cyng...> |
Commiter | Howard Harte |
Adding NULL checks AsyncResultProgram.java
Discovered NULL object dereference during the monkey test. Resolving possible NULL dereferences.
Issue-Id: YAM-61
Change-Id: I2b03338557d0f5590678cb1c0532c5cc6f586049
@@ -127,8 +127,10 @@ public abstract class AsyncResultProgram | ||
127 | 127 | */ |
128 | 128 | public final void onRequestEndParsePartialResult(boolean cancelled) { |
129 | 129 | synchronized (this.mSync) { |
130 | - this.mWorkerThread.mAlive = false; | |
131 | - this.mSync.notify(); | |
130 | + if (this.mWorkerThread != null) { | |
131 | + this.mWorkerThread.mAlive = false; | |
132 | + this.mSync.notify(); | |
133 | + } | |
132 | 134 | } |
133 | 135 | |
134 | 136 | try { |
@@ -258,8 +260,10 @@ public abstract class AsyncResultProgram | ||
258 | 260 | |
259 | 261 | //Stop the thread |
260 | 262 | synchronized (this.mSync) { |
261 | - this.mWorkerThread.mAlive = false; | |
262 | - this.mSync.notify(); | |
263 | + if (this.mWorkerThread != null) { | |
264 | + this.mWorkerThread.mAlive = false; | |
265 | + this.mSync.notify(); | |
266 | + } | |
263 | 267 | } |
264 | 268 | |
265 | 269 | //Notify cancellation |
@@ -285,8 +289,10 @@ public abstract class AsyncResultProgram | ||
285 | 289 | |
286 | 290 | //Stop the thread |
287 | 291 | synchronized (this.mSync) { |
288 | - this.mWorkerThread.mAlive = false; | |
289 | - this.mSync.notify(); | |
292 | + if (this.mWorkerThread != null) { | |
293 | + this.mWorkerThread.mAlive = false; | |
294 | + this.mSync.notify(); | |
295 | + } | |
290 | 296 | } |
291 | 297 | |
292 | 298 | //Notify ending |