File tree Expand file tree Collapse file tree
WordPress/src/main/java/org/wordpress/android/util/image Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ import org.wordpress.android.util.AppLog
4646import org.wordpress.android.util.image.ImageType.VIDEO
4747import java.io.File
4848import java.util.Locale
49+ import java.util.concurrent.ExecutionException
4950import javax.inject.Inject
5051import javax.inject.Singleton
5152
@@ -308,11 +309,16 @@ class ImageManager @Inject constructor(
308309 */
309310 fun preload (context : Context , design : MShot ) {
310311 if (! context.isAvailable()) return
311- GlideApp .with (context)
312- .downloadOnly()
313- .load(design)
314- .submit()
315- .get() // This makes each call blocking, so subsequent calls can be cancelled if needed.
312+ try {
313+ GlideApp .with (context)
314+ .downloadOnly()
315+ .load(design)
316+ .submit()
317+ .get() // This makes each call blocking, so subsequent calls can be cancelled if needed.
318+ } catch (e: ExecutionException ) {
319+ // This is a best effort preload, so we don't want to crash the app if an `ExecutionException` is thrown.
320+ AppLog .e(AppLog .T .UTILS , " Error preloading MShot: $e " )
321+ }
316322 }
317323
318324 /* *
You can’t perform that action at this time.
0 commit comments