53
53
* Category processor.
54
54
*
55
55
* @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
57
57
* @since 2.0.0
58
58
*/
59
59
@ RequestProcessor
@@ -192,6 +192,13 @@ public void showCategoryArticles(final HTTPRequestContext context) throws IOExce
192
192
final JSONObject result = articleQueryService .getCategoryArticles (categoryId , currentPageNum , pageSize );
193
193
final List <JSONObject > articles = (List <JSONObject >) result .opt (Article .ARTICLES );
194
194
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
+
195
202
Skins .fillLangs (preference .optString (Option .ID_C_LOCALE_STRING ), (String ) request .getAttribute (Keys .TEMAPLTE_DIR_NAME ), dataModel );
196
203
197
204
final boolean hasMultipleUsers = userQueryService .hasMultipleUsers ();
@@ -204,13 +211,6 @@ public void showCategoryArticles(final HTTPRequestContext context) throws IOExce
204
211
filler .setArticlesExProperties (request , articles , author , preference );
205
212
}
206
213
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
-
214
214
final List <Integer > pageNums = (List ) result .optJSONObject (Pagination .PAGINATION ).opt (Pagination .PAGINATION_PAGE_NUMS );
215
215
216
216
fillPagination (dataModel , pageCount , currentPageNum , articles , pageNums );
0 commit comments