Skip to content

Commit cb6a75c

Browse files
author
Hristo Hristov
authored
Fix crash on API 23 where constantState.newDrawable(nativeView.getResources()); throws exception in Java. (NativeScript#4959)
Fix nstudio/nativescript-floatingactionbutton#57 Addition to NativeScript#4728
1 parent f0a060a commit cb6a75c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tns-core-modules/ui/core/view/view.android.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,11 @@ export class View extends ViewCommon {
460460
if (drawable) {
461461
const constantState = drawable.getConstantState();
462462
if (constantState) {
463-
return constantState.newDrawable(nativeView.getResources());
463+
try {
464+
return constantState.newDrawable(nativeView.getResources());
465+
} catch (e) {
466+
return drawable;
467+
}
464468
} else {
465469
return drawable;
466470
}

0 commit comments

Comments
 (0)