1
0
mirror of synced 2025-12-12 09:41:35 +08:00

🎨 Add null check for textJsonElement in WxCpUserGsonAdapter

This commit is contained in:
zhfkt
2025-07-04 15:40:29 +08:00
committed by GitHub
parent d52e225626
commit 84c69d4900

View File

@@ -127,8 +127,12 @@ public class WxCpUserGsonAdapter implements JsonDeserializer<WxCpUser>, JsonSeri
switch (type) { switch (type) {
case 0: { case 0: {
attr.setTextValue(GsonHelper.getString(attrJsonElement.getAsJsonObject().get("text").getAsJsonObject(), JsonElement textJsonElement = attrJsonElement.getAsJsonObject().get("text");
"value")); 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; break;
} }
case 1: { case 1: {