mb_tail_dda: some code forgot to check for null

This commit is contained in:
Phil Hord 2016-12-20 15:27:31 -08:00
parent 4573a8fbbb
commit 80136a51d8
2 changed files with 16 additions and 14 deletions

View File

@ -67,7 +67,7 @@ void queue_step() {
This needs no atomic protection, because we're in an interrupt already.
*/
if ( ! mb_tail_dda->live) {
if (mb_tail_dda == NULL || ! mb_tail_dda->live) {
if (mb_tail != mb_head) {
mb_tail = MB_NEXT(mb_tail);
mb_tail_dda = &(movebuffer[mb_tail]);

View File

@ -609,19 +609,21 @@ void process_gcode_command() {
current_position.axis[Z], current_position.axis[E],
current_position.F);
if (DEBUG_POSITION && (debug_flags & DEBUG_POSITION)) {
sersendf_P(PSTR("Endpoint: X:%ld,Y:%ld,Z:%ld,E:%ld,F:%lu,c:%lu}\n"),
mb_tail_dda->endpoint.axis[X],
mb_tail_dda->endpoint.axis[Y],
mb_tail_dda->endpoint.axis[Z],
mb_tail_dda->endpoint.axis[E],
mb_tail_dda->endpoint.F,
#ifdef ACCELERATION_REPRAP
mb_tail_dda->end_c
#else
mb_tail_dda->c
#endif
);
if (mb_tail_dda != NULL) {
if (DEBUG_POSITION && (debug_flags & DEBUG_POSITION)) {
sersendf_P(PSTR("Endpoint: X:%ld,Y:%ld,Z:%ld,E:%ld,F:%lu,c:%lu}\n"),
mb_tail_dda->endpoint.axis[X],
mb_tail_dda->endpoint.axis[Y],
mb_tail_dda->endpoint.axis[Z],
mb_tail_dda->endpoint.axis[E],
mb_tail_dda->endpoint.F,
#ifdef ACCELERATION_REPRAP
mb_tail_dda->end_c
#else
mb_tail_dda->c
#endif
);
}
print_queue();
}