Make sure not to dereference an invalid TrackIter
switch(type)
{
case GOTO_SENSOR:
- return "set route to sensor "+get_param<unsigned>(0);
+ return format("set route to sensor %d", get_param<unsigned>(0));
case GOTO_ZONE:
return "set route to "+get_param<string>(0);
case TRAVEL_TO:
float margin = 0;
TrackIter next = blocks.back().next().track_iter();
- if(next->get_type().is_turnout())
+ if(next && next->get_type().is_turnout())
margin = 15*layout.get_catalogue().get_scale();
return max(get_reserved_distance_until(0, false)-margin, 0.0f);