@@ -98,9 +98,9 @@ public WxCpUser deserialize(JsonElement json, Type typeOfT, JsonDeserializationC
9898 if (GsonHelper .isNotNull (o .get (EXTERNAL_PROFILE ))) {
9999 user .setExternalCorpName (GsonHelper .getString (o .getAsJsonObject ().get (EXTERNAL_PROFILE ).getAsJsonObject (), EXTERNAL_CORP_NAME ));
100100 JsonElement jsonElement = o .get (EXTERNAL_PROFILE ).getAsJsonObject ().get (WECHAT_CHANNELS );
101- if (jsonElement !=null ){
101+ if (jsonElement != null ) {
102102 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 ());
104104 }
105105 this .buildExternalAttrs (o , user );
106106 }
@@ -140,7 +140,12 @@ private void buildExtraAttrs(JsonObject o, WxCpUser user) {
140140 }
141141
142142 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 ();
144149 for (JsonElement element : attrJsonElements ) {
145150 final Integer type = GsonHelper .getInteger (element .getAsJsonObject (), "type" );
146151 final String name = GsonHelper .getString (element .getAsJsonObject (), "name" );
@@ -328,8 +333,8 @@ public JsonElement serialize(WxCpUser user, Type typeOfSrc, JsonSerializationCon
328333 attrsJson .addProperty (EXTERNAL_CORP_NAME , user .getExternalCorpName ());
329334 }
330335
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 ()));
333338 }
334339
335340 if (!user .getExternalAttrs ().isEmpty ()) {
0 commit comments