From: Ian Jackson Date: Fri, 7 Jan 2011 01:51:10 +0000 (+0000) Subject: hostside/gui-plan: do not crash on the first "movepos Z0 position ? moving" (untested) X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=3852fe990c1fe670298c6655570614adbb6e2389;p=trains.git hostside/gui-plan: do not crash on the first "movepos Z0 position ? moving" (untested) --- diff --git a/hostside/gui-plan.c b/hostside/gui-plan.c index 67e08a1..18fa08b 100644 --- a/hostside/gui-plan.c +++ b/hostside/gui-plan.c @@ -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; }