Commit 10c83912 authored by D's avatar D Committed by GitHub

Merge pull request #12876 from lzh984294471/3.6.5-dev

修复修改分类时空指针错误
parents 36835513 0fec767c
......@@ -154,6 +154,7 @@ public class CategoryConsole {
* @param context the specified request context
* @throws Exception exception
*/
@SuppressWarnings("unchecked")
public void getCategory(final RequestContext context) {
final JsonRenderer renderer = new JsonRenderer();
context.setRenderer(renderer);
......@@ -169,6 +170,9 @@ public class CategoryConsole {
final StringBuilder tagBuilder = new StringBuilder();
final List<JSONObject> tags = (List<JSONObject>) result.opt(Category.CATEGORY_T_TAGS);
for (final JSONObject tag : tags) {
if (tag == null || !tag.has(Tag.TAG_TITLE)){
continue;
}
tagBuilder.append(tag.optString(Tag.TAG_TITLE)).append(",");
}
tagBuilder.deleteCharAt(tagBuilder.length() - 1);
......
......@@ -115,7 +115,9 @@ public class CategoryQueryService {
for (final JSONObject relation : relations) {
final String tagId = relation.optString(Tag.TAG + "_" + Keys.OBJECT_ID);
final JSONObject tag = tagRepository.get(tagId);
if (tag == null){
continue;
}
ret.add(tag);
}
} catch (final RepositoryException e) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment