mirror of
https://gitee.com/binary/weixin-java-tools.git
synced 2025-08-20 00:44:25 +08:00
🎨 Add null check for textJsonElement in WxCpUserGsonAdapter
This commit is contained in:
parent
d52e225626
commit
84c69d4900
@ -127,8 +127,12 @@ public class WxCpUserGsonAdapter implements JsonDeserializer<WxCpUser>, JsonSeri
|
||||
|
||||
switch (type) {
|
||||
case 0: {
|
||||
attr.setTextValue(GsonHelper.getString(attrJsonElement.getAsJsonObject().get("text").getAsJsonObject(),
|
||||
"value"));
|
||||
JsonElement textJsonElement = attrJsonElement.getAsJsonObject().get("text");
|
||||
if (textJsonElement != null && !textJsonElement.isJsonNull() && textJsonElement.isJsonObject()) {
|
||||
attr.setTextValue(GsonHelper.getString(textJsonElement.getAsJsonObject(), "value"));
|
||||
} else {
|
||||
attr.setTextValue(null); // Clear or set a default value to avoid stale data
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
|
Loading…
Reference in New Issue
Block a user