提交 109c935e 编写于 作者: 智布道's avatar 智布道 👁

🐛 解决 NPE

上级 dfdf1001
......@@ -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");
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册