fixed a nil dereferencing bug in planner_forward_pass_kernel thanks to jv4779

This commit is contained in:
Simen Svale Skogsrud 2011-07-10 21:54:03 +02:00
parent 804837a111
commit 5466bc0c33

View File

@ -206,13 +206,15 @@ static void planner_forward_pass_kernel(block_t *previous, block_t *current, blo
// If the previous block is an acceleration block, but it is not long enough to // If the previous block is an acceleration block, but it is not long enough to
// complete the full speed change within the block, we need to adjust out entry // complete the full speed change within the block, we need to adjust out entry
// speed accordingly. Remember current->entry_factor equals the exit factor of // speed accordingly. Remember current->entry_factor equals the exit factor of
// the previous block. // the previous block.¨
if(previous->entry_factor < current->entry_factor) { if(previous) {
double max_entry_speed = max_allowable_speed(-settings.acceleration, if(previous->entry_factor < current->entry_factor) {
current->nominal_speed*previous->entry_factor, previous->millimeters); double max_entry_speed = max_allowable_speed(-settings.acceleration,
double max_entry_factor = max_entry_speed/current->nominal_speed; current->nominal_speed*previous->entry_factor, previous->millimeters);
if (max_entry_factor < current->entry_factor) { double max_entry_factor = max_entry_speed/current->nominal_speed;
current->entry_factor = max_entry_factor; if (max_entry_factor < current->entry_factor) {
current->entry_factor = max_entry_factor;
}
} }
} }
} }