@@ -342,17 +342,19 @@ protected void handleMessage(Message msg) {
342
342
switch (msg .what ) {
343
343
case SUCCESS_MESSAGE :
344
344
response = (Object []) msg .obj ;
345
- if (response != null && response .length >= 3 )
345
+ if (response != null && response .length >= 3 ) {
346
346
onSuccess ((Integer ) response [0 ], (Header []) response [1 ], (byte []) response [2 ]);
347
- else
347
+ } else {
348
348
Log .e (LOG_TAG , "SUCCESS_MESSAGE didn't got enough params" );
349
+ }
349
350
break ;
350
351
case FAILURE_MESSAGE :
351
352
response = (Object []) msg .obj ;
352
- if (response != null && response .length >= 4 )
353
+ if (response != null && response .length >= 4 ) {
353
354
onFailure ((Integer ) response [0 ], (Header []) response [1 ], (byte []) response [2 ], (Throwable ) response [3 ]);
354
- else
355
+ } else {
355
356
Log .e (LOG_TAG , "FAILURE_MESSAGE didn't got enough params" );
357
+ }
356
358
break ;
357
359
case START_MESSAGE :
358
360
onStart ();
@@ -362,10 +364,15 @@ protected void handleMessage(Message msg) {
362
364
break ;
363
365
case PROGRESS_MESSAGE :
364
366
response = (Object []) msg .obj ;
365
- if (response != null && response .length >= 2 )
366
- onProgress ((Integer ) response [0 ], (Integer ) response [1 ]);
367
- else
367
+ if (response != null && response .length >= 2 ) {
368
+ try {
369
+ onProgress ((Integer ) response [0 ], (Integer ) response [1 ]);
370
+ } catch (Throwable t ) {
371
+ Log .e (LOG_TAG , "custom onProgress contains an error" , t );
372
+ }
373
+ } else {
368
374
Log .e (LOG_TAG , "PROGRESS_MESSAGE didn't got enough params" );
375
+ }
369
376
break ;
370
377
case RETRY_MESSAGE :
371
378
onRetry ();
0 commit comments