diff --git a/blog-core/src/main/java/com/zyd/blog/business/service/impl/BizCommentServiceImpl.java b/blog-core/src/main/java/com/zyd/blog/business/service/impl/BizCommentServiceImpl.java index 848f373e1debfa6c626cd156b204227c92e8aee4..696524574c6a9dd76c40d8b7573b77483fd6a143 100644 --- a/blog-core/src/main/java/com/zyd/blog/business/service/impl/BizCommentServiceImpl.java +++ b/blog-core/src/main/java/com/zyd/blog/business/service/impl/BizCommentServiceImpl.java @@ -284,9 +284,11 @@ public class BizCommentServiceImpl implements BizCommentService { try { String locationJson = RestClientUtil.get(UrlBuildUtil.getLocationByIp(comment.getIp(), (String) config.get(ConfigKeyEnum.BAIDU_API_AK.getKey()))); JSONObject localtionContent = JSONObject.parseObject(locationJson).getJSONObject("content"); - JSONObject point = localtionContent.getJSONObject("point"); - comment.setLat(point.getString("y")); - comment.setLng(point.getString("x")); + if (localtionContent.containsKey("point")) { + JSONObject point = localtionContent.getJSONObject("point"); + comment.setLat(point.getString("y")); + comment.setLng(point.getString("x")); + } if (localtionContent.containsKey("address_detail")) { JSONObject addressDetail = localtionContent.getJSONObject("address_detail");