소스 검색

Fix a bug of incorrect response bodies for 'query' request with values of '0', 'foo', and '501'

AOYAMA Kazuharu 11 년 전
부모
커밋
02df6d5f3d
2개의 변경된 파일7개의 추가작업 그리고 1개의 파일을 삭제
  1. 6 1
      treefrog/controllers/worldcontroller.cpp
  2. 1 0
      treefrog/controllers/worldcontroller.h

+ 6 - 1
treefrog/controllers/worldcontroller.cpp

@@ -25,10 +25,15 @@ void WorldController::show(const QString &pk)
     render();
 }
 
+void WorldController::queries()
+{
+    queries("1");
+}
+
 void WorldController::queries(const QString &num)
 {
     QList<QVariantMap> worlds;
-    int d = num.toInt();
+    int d = qMin(qMax(num.toInt(), 1), 500);
 
     for (int i = 0; i < d; ++i) {
         int id = Tf::random(9999) + 1;

+ 1 - 0
treefrog/controllers/worldcontroller.h

@@ -17,6 +17,7 @@ public slots:
     void index();
     void plain();
     void show(const QString &pk);
+    void queries();
     void queries(const QString &num);
     void random();
     void entry();