chiark / gitweb /
script: Fix a (silent) JS error
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 31 Mar 2021 17:26:08 +0000 (18:26 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 1 Apr 2021 10:38:14 +0000 (11:38 +0100)
When the api queue is empty this would spew a harmless error into the
log.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
templates/script.ts

index f0e33e1ed3fc411c3f0da6163e67ce14daecba4b..46fc96d8ab2074e384313444913bd5edc3564fd8 100644 (file)
@@ -207,7 +207,7 @@ function api_check() {
     if (p == null) break;
     p.queued_moves--;
     if (p.queued_moves == 0) break;
-  } while(1);
+  } while (api_queue.length);
   api_posting = true;
   xhr_post_then('/_/api/'+meth, JSON.stringify(data), api_posted);
 }