comparison tests/plrtest.c @ 793:21ad08cdf408

Fix a potential NULL pointer usage.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 18 Oct 2013 14:31:12 +0300
parents ed60a7ee3ebb
children 319792b2af4a
comparison
equal deleted inserted replaced
792:bfb1d2bacd54 793:21ad08cdf408
217 SDL_PauseAudio(0); 217 SDL_PauseAudio(0);
218 SDL_UnlockAudio(); 218 SDL_UnlockAudio();
219 BOOL playing = TRUE; 219 BOOL playing = TRUE;
220 while (playing) 220 while (playing)
221 { 221 {
222 JSSPattern *pattern; 222 JSSPattern *pattern = NULL;
223 int currRow, prevRow; 223 int currRow, prevRow;
224 224
225 JSS_LOCK(plr); 225 JSS_LOCK(plr);
226 currRow = prevRow = plr->row; 226 currRow = prevRow = plr->row;
227 JSS_UNLOCK(plr); 227 JSS_UNLOCK(plr);
234 pattern = plr->pattern; 234 pattern = plr->pattern;
235 JSS_UNLOCK(plr); 235 JSS_UNLOCK(plr);
236 SDL_Delay(50); 236 SDL_Delay(50);
237 } 237 }
238 238
239 if (playing) 239 if (playing && pattern != NULL)
240 { 240 {
241 printRow(stdout, pattern, currRow); 241 printRow(stdout, pattern, currRow);
242 printf("\n"); 242 printf("\n");
243 } 243 }
244 } 244 }