chiark / gitweb /
script: lower: Bail early if no targets
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 10 Jul 2021 12:36:36 +0000 (13:36 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 10 Jul 2021 15:24:51 +0000 (16:24 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
templates/script.ts

index 150353b094f4d64855479574202d272b4a87a7c2..e43819c1547a358f00d60d9ba281ca235e344d11 100644 (file)
@@ -646,10 +646,13 @@ function lower_pieces(targets_todo: LowerTodoList):
   let bottommost_unbottom : Entry | null = null;
 
   let n_targets_todo_unbottom = 0;
+  let any_targets = false;
   for (const piece of Object.keys(targets_todo)) {
+    any_targets = true;
     let p = targets_todo[piece];
     if (!p.bottom) n_targets_todo_unbottom++;
   }
+  if (!any_targets) return 'Nothing to lower!';
 
   let walk = pieces_marker;
   for (;;) { // starting at the bottom of the stack order