comparison tools/ppl.c @ 1258:13c274d22a29

Add some extra error checking.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 09 Mar 2015 19:00:13 +0200
parents e8c99da451cd
children 2260ed90ab6b
comparison
equal deleted inserted replaced
1257:60dc14a2e4c5 1258:13c274d22a29
466 qwidth = ((x1 - x0 - lwidth) / cwidth), 466 qwidth = ((x1 - x0 - lwidth) / cwidth),
467 qheight = ((qy1 - qy0 - 4) / (font->height + 1)), 467 qheight = ((qy1 - qy0 - 4) / (font->height + 1)),
468 nrow, nchannel, yc, choffs, 468 nrow, nchannel, yc, choffs,
469 midrow = qheight / 2; 469 midrow = qheight / 2;
470 470
471 if (pat == NULL)
472 return;
473
471 if (engine.actChannel < qwidth / 2) 474 if (engine.actChannel < qwidth / 2)
472 choffs = 0; 475 choffs = 0;
473 else 476 else
474 if (engine.actChannel >= pat->nchannels - qwidth/2) 477 if (engine.actChannel >= pat->nchannels - qwidth/2)
475 choffs = pat->nchannels - qwidth; 478 choffs = pat->nchannels - qwidth;
862 865
863 JSS_LOCK(engine.plr); 866 JSS_LOCK(engine.plr);
864 dmDrawBMTextQ(engine.screen, font, DMD_TRANSPARENT, 5, 5 + 12, 867 dmDrawBMTextQ(engine.screen, font, DMD_TRANSPARENT, 5, 5 + 12,
865 "Tempo: %3d | Speed: %3d | Row: %3d/%-3d | Order: %3d/%-3d | Pattern: %3d/%-3d", 868 "Tempo: %3d | Speed: %3d | Row: %3d/%-3d | Order: %3d/%-3d | Pattern: %3d/%-3d",
866 engine.plr->tempo, engine.plr->speed, 869 engine.plr->tempo, engine.plr->speed,
867 engine.plr->row, engine.plr->pattern->nrows, 870 engine.plr->row, (engine.plr->pattern != NULL) ? engine.plr->pattern->nrows : 0,
868 engine.plr->order, engine.mod->norders, 871 engine.plr->order, engine.mod->norders,
869 engine.plr->npattern, engine.mod->npatterns); 872 engine.plr->npattern, engine.mod->npatterns);
870 JSS_UNLOCK(engine.plr); 873 JSS_UNLOCK(engine.plr);
871 updated = TRUE; 874 updated = TRUE;
872 } 875 }