Browse Source

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

AOYAMA Kazuharu 11 years ago
parent
commit
02df6d5f3d

+ 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();