@@ -98,9 +98,9 @@ public WxCpUser deserialize(JsonElement json, Type typeOfT, JsonDeserializationC
98
98
if (GsonHelper .isNotNull (o .get (EXTERNAL_PROFILE ))) {
99
99
user .setExternalCorpName (GsonHelper .getString (o .getAsJsonObject ().get (EXTERNAL_PROFILE ).getAsJsonObject (), EXTERNAL_CORP_NAME ));
100
100
JsonElement jsonElement = o .get (EXTERNAL_PROFILE ).getAsJsonObject ().get (WECHAT_CHANNELS );
101
- if (jsonElement !=null ){
101
+ if (jsonElement != null ) {
102
102
JsonObject asJsonObject = jsonElement .getAsJsonObject ();
103
- user .setWechatChannels (WechatChannels .builder ().nickname (GsonHelper .getString (asJsonObject ,"nickname" )).status (GsonHelper .getInteger (asJsonObject ,"status" )).build ());
103
+ user .setWechatChannels (WechatChannels .builder ().nickname (GsonHelper .getString (asJsonObject , "nickname" )).status (GsonHelper .getInteger (asJsonObject , "status" )).build ());
104
104
}
105
105
this .buildExternalAttrs (o , user );
106
106
}
@@ -140,7 +140,12 @@ private void buildExtraAttrs(JsonObject o, WxCpUser user) {
140
140
}
141
141
142
142
private void buildExternalAttrs (JsonObject o , WxCpUser user ) {
143
- JsonArray attrJsonElements = o .get (EXTERNAL_PROFILE ).getAsJsonObject ().get (EXTERNAL_ATTR ).getAsJsonArray ();
143
+ JsonElement jsonElement = o .get (EXTERNAL_PROFILE ).getAsJsonObject ().get (EXTERNAL_ATTR );
144
+ if (jsonElement == null ) {
145
+ return ;
146
+ }
147
+
148
+ JsonArray attrJsonElements = jsonElement .getAsJsonArray ();
144
149
for (JsonElement element : attrJsonElements ) {
145
150
final Integer type = GsonHelper .getInteger (element .getAsJsonObject (), "type" );
146
151
final String name = GsonHelper .getString (element .getAsJsonObject (), "name" );
@@ -328,8 +333,8 @@ public JsonElement serialize(WxCpUser user, Type typeOfSrc, JsonSerializationCon
328
333
attrsJson .addProperty (EXTERNAL_CORP_NAME , user .getExternalCorpName ());
329
334
}
330
335
331
- if (user .getWechatChannels () != null ){
332
- attrsJson .add (WECHAT_CHANNELS ,GsonHelper .buildJsonObject ("nickname" , user .getWechatChannels ().getNickname (), "status" , user .getWechatChannels ().getStatus ()));
336
+ if (user .getWechatChannels () != null ) {
337
+ attrsJson .add (WECHAT_CHANNELS , GsonHelper .buildJsonObject ("nickname" , user .getWechatChannels ().getNickname (), "status" , user .getWechatChannels ().getStatus ()));
333
338
}
334
339
335
340
if (!user .getExternalAttrs ().isEmpty ()) {
0 commit comments