Skip to content

Commit 3e5686a

Browse files
committed
🐛 Fix b3log#12338
目前的解决方案是报 404 😅
1 parent 44acc47 commit 3e5686a

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/main/java/org/b3log/solo/processor/CategoryProcessor.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
* Category processor.
5454
*
5555
* @author <a href="http://88250.b3log.org">Liang Ding</a>
56-
* @version 1.0.0.2, Apr 10, 2017
56+
* @version 1.0.1.2, Apr 21, 2017
5757
* @since 2.0.0
5858
*/
5959
@RequestProcessor
@@ -192,6 +192,13 @@ public void showCategoryArticles(final HTTPRequestContext context) throws IOExce
192192
final JSONObject result = articleQueryService.getCategoryArticles(categoryId, currentPageNum, pageSize);
193193
final List<JSONObject> articles = (List<JSONObject>) result.opt(Article.ARTICLES);
194194

195+
final int pageCount = result.optJSONObject(Pagination.PAGINATION).optInt(Pagination.PAGINATION_PAGE_COUNT);
196+
if (0 == pageCount) {
197+
response.sendError(HttpServletResponse.SC_NOT_FOUND);
198+
199+
return;
200+
}
201+
195202
Skins.fillLangs(preference.optString(Option.ID_C_LOCALE_STRING), (String) request.getAttribute(Keys.TEMAPLTE_DIR_NAME), dataModel);
196203

197204
final boolean hasMultipleUsers = userQueryService.hasMultipleUsers();
@@ -204,13 +211,6 @@ public void showCategoryArticles(final HTTPRequestContext context) throws IOExce
204211
filler.setArticlesExProperties(request, articles, author, preference);
205212
}
206213

207-
final int pageCount = result.optJSONObject(Pagination.PAGINATION).optInt(Pagination.PAGINATION_PAGE_COUNT);
208-
if (0 == pageCount) {
209-
response.sendError(HttpServletResponse.SC_NOT_FOUND);
210-
211-
return;
212-
}
213-
214214
final List<Integer> pageNums = (List) result.optJSONObject(Pagination.PAGINATION).opt(Pagination.PAGINATION_PAGE_NUMS);
215215

216216
fillPagination(dataModel, pageCount, currentPageNum, articles, pageNums);

0 commit comments

Comments
 (0)