chiark / gitweb /
hostside/gui-plan: do not crash on the first "movepos Z0 position ? moving" (untested)
authorIan Jackson <ian@liberator.relativity.greenend.org.uk>
Fri, 7 Jan 2011 01:51:10 +0000 (01:51 +0000)
committerIan Jackson <ian@liberator.relativity.greenend.org.uk>
Fri, 7 Jan 2011 01:51:10 +0000 (01:51 +0000)
hostside/gui-plan.c

index 67e08a140bc68e048903a156c8e1e4f34046ce89..18fa08b74dac4c4685a9d1e916337b3c764e980d 100644 (file)
@@ -617,8 +617,10 @@ static void si_movpos(ParseState *ps) {
   r= ps_needword(ps);                                    if (r) return;
   if (!thiswordstrcmp(ps,"?")) {
     int f;
-    for (f=0; f < ui_plan_data.segments[s].n_movfeats; f++)
-      state[s].mfs[f].posn= ui_plan_data.segments[s].movfeats[f].n_posns;
+    for (f=0; f < ui_plan_data.segments[s].n_movfeats; f++) {
+      int n_posns= ui_plan_data.segments[s].movfeats[f].n_posns;
+      if (n_posns > 1) state[s].mfs[f].posn= n_posns;
+    }
     mx_redraw_seg(s);
     return;
   }