Fix inspector crash on null colors
Summary: Quick fix for layout plugin and export crashing when encountering nullable props for colors and drawables like `refreshProgressBarBackgroundColor` on `RecyclerSpec`. The rendered view in the inspector is not great right now, but better than a crash. Working on the correct representation next. Reviewed By: jknoxville Differential Revision: D15241151 fbshipit-source-id: 3754dee8861a442127a34d7c3211d223c5f390c1
This commit is contained in:
committed by
Facebook Github Bot
parent
9bd6b6a607
commit
2cdcd9bad9
@@ -25,7 +25,6 @@ import javax.annotation.Nullable;
|
||||
|
||||
public class DataUtils {
|
||||
|
||||
@Nullable
|
||||
static List<com.facebook.flipper.plugins.inspector.Named<com.facebook.flipper.core.FlipperObject>>
|
||||
getPropData(Object node) throws Exception {
|
||||
final FlipperObject.Builder props = new FlipperObject.Builder();
|
||||
@@ -49,10 +48,10 @@ public class DataUtils {
|
||||
|
||||
switch (annotation.resType()) {
|
||||
case COLOR:
|
||||
props.put(f.getName(), fromColor((Integer) f.get(node)));
|
||||
props.put(f.getName(), f.get(node) == null ? "null" : fromColor((Integer) f.get(node)));
|
||||
break;
|
||||
case DRAWABLE:
|
||||
props.put(f.getName(), fromDrawable((Drawable) f.get(node)));
|
||||
props.put(f.getName(), f.get(node) == null ? "null" : fromDrawable((Drawable) f.get(node)));
|
||||
break;
|
||||
default:
|
||||
if (f.get(node) != null
|
||||
|
||||
Reference in New Issue
Block a user