From 5ca914fda3b4ce01f6c1e37687de52ba96f46dd3 Mon Sep 17 00:00:00 2001 From: "pengfei.zhou" Date: Tue, 10 Dec 2019 13:40:20 +0800 Subject: [PATCH] feat:fix ListAdapter npe --- doric/src/main/java/pub/doric/shader/list/ListAdapter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doric/src/main/java/pub/doric/shader/list/ListAdapter.java b/doric/src/main/java/pub/doric/shader/list/ListAdapter.java index 5b96a3c0..dc95cfa4 100644 --- a/doric/src/main/java/pub/doric/shader/list/ListAdapter.java +++ b/doric/src/main/java/pub/doric/shader/list/ListAdapter.java @@ -60,7 +60,7 @@ class ListAdapter extends RecyclerView.Adapter { @Override public void onBindViewHolder(@NonNull DoricViewHolder holder, int position) { JSValue jsValue = getItemModel(position); - if (jsValue.isObject()) { + if (jsValue != null && jsValue.isObject()) { JSObject jsObject = jsValue.asObject(); holder.listItemNode.setId(jsObject.getProperty("id").asString().value()); holder.listItemNode.blend(jsObject.getProperty("props").asObject()); @@ -75,7 +75,7 @@ class ListAdapter extends RecyclerView.Adapter { @Override public int getItemViewType(int position) { JSValue value = getItemModel(position); - if (value.isObject()) { + if (value != null && value.isObject()) { if (value.asObject().getProperty("identifier").isString()) { return value.asObject().getProperty("identifier").asString().value().hashCode(); }