Commit f09bba9a authored by Liang Ding's avatar Liang Ding

🐛 Fix category mgmt NPE

parent 2b84f8f1
...@@ -41,7 +41,7 @@ import java.util.List; ...@@ -41,7 +41,7 @@ import java.util.List;
* Category query service. * Category query service.
* *
* @author <a href="http://88250.b3log.org">Liang Ding</a> * @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.1, Mar 31, 2017 * @version 1.0.1.1, Apr 12, 2017
* @since 2.0.0 * @since 2.0.0
*/ */
@Service @Service
...@@ -244,6 +244,10 @@ public class CategoryQueryService { ...@@ -244,6 +244,10 @@ public class CategoryQueryService {
public JSONObject getCategory(final String categoryId) throws ServiceException { public JSONObject getCategory(final String categoryId) throws ServiceException {
try { try {
final JSONObject ret = categoryRepository.get(categoryId); final JSONObject ret = categoryRepository.get(categoryId);
if (null == ret) {
return null;
}
final List<JSONObject> tags = getTags(categoryId); final List<JSONObject> tags = getTags(categoryId);
ret.put(Category.CATEGORY_T_TAGS, (Object) tags); ret.put(Category.CATEGORY_T_TAGS, (Object) tags);
......
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