@@ -10,6 +10,7 @@ package com.facebook.fresco.vito.core.impl
10
10
import android.content.res.Resources
11
11
import android.graphics.drawable.ColorDrawable
12
12
import android.graphics.drawable.Drawable
13
+ import com.facebook.common.logging.FLog
13
14
import com.facebook.common.references.CloseableReference
14
15
import com.facebook.drawee.drawable.ForwardingDrawable
15
16
import com.facebook.drawee.drawable.ScaleTypeDrawable
@@ -22,6 +23,8 @@ import com.facebook.imagepipeline.systrace.FrescoSystrace
22
23
23
24
open class HierarcherImpl (private val drawableFactory : ImageOptionsDrawableFactory ) : Hierarcher {
24
25
26
+ private val TAG = " HierarcherImpl"
27
+
25
28
override fun buildActualImageDrawable (
26
29
resources : Resources ,
27
30
imageOptions : ImageOptions ,
@@ -41,8 +44,13 @@ open class HierarcherImpl(private val drawableFactory: ImageOptionsDrawableFacto
41
44
return try {
42
45
var placeholderDrawable = imageOptions.placeholderDrawable
43
46
if (placeholderDrawable == null && imageOptions.placeholderRes != 0 ) {
44
- placeholderDrawable = resources.getDrawable(imageOptions.placeholderRes)
45
- } else if (placeholderDrawable == null ) {
47
+ try {
48
+ placeholderDrawable = resources.getDrawable(imageOptions.placeholderRes)
49
+ } catch (e: Resources .NotFoundException ) {
50
+ FLog .e(TAG , " Placeholder drawable not found in Resources" , e)
51
+ }
52
+ }
53
+ if (placeholderDrawable == null ) {
46
54
placeholderDrawable = imageOptions.placeholderColor?.let (::ColorDrawable )
47
55
}
48
56
0 commit comments