comparison src/xmms-sid.c @ 794:3012740d014c

Add some NULL pointer checks in case the emulator engine backend didn't initialize and the user tries to play things anyway.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 07 Nov 2012 11:04:34 +0200
parents 8f0d11865742
children 02512cbc6d9f
comparison
equal deleted inserted replaced
793:0617f844ebdb 794:3012740d014c
214 /* Stop playing, free structures */ 214 /* Stop playing, free structures */
215 xs_stop(); 215 xs_stop();
216 216
217 xs_tuneinfo_free(xs_status.tuneInfo); 217 xs_tuneinfo_free(xs_status.tuneInfo);
218 xs_status.tuneInfo = NULL; 218 xs_status.tuneInfo = NULL;
219 xs_status.engine->plrDeleteSID(&xs_status); 219 if (xs_status.engine != NULL)
220 xs_status.engine->plrClose(&xs_status); 220 {
221 xs_status.engine->plrDeleteSID(&xs_status);
222 xs_status.engine->plrClose(&xs_status);
223 }
221 224
222 xs_songlen_close(); 225 xs_songlen_close();
223 xs_stil_close(); 226 xs_stil_close();
224 227
225 XSDEBUG("shutdown finished.\n"); 228 XSDEBUG("shutdown finished.\n");
581 */ 584 */
582 xs_fileinfo_update(); 585 xs_fileinfo_update();
583 586
584 /* Free tune information */ 587 /* Free tune information */
585 XS_MUTEX_LOCK(xs_status); 588 XS_MUTEX_LOCK(xs_status);
586 xs_status.engine->plrDeleteSID(&xs_status); 589 if (xs_status.engine != NULL)
590 xs_status.engine->plrDeleteSID(&xs_status);
591
587 xs_tuneinfo_free(xs_status.tuneInfo); 592 xs_tuneinfo_free(xs_status.tuneInfo);
588 xs_status.tuneInfo = NULL; 593 xs_status.tuneInfo = NULL;
589 XS_MUTEX_UNLOCK(xs_status); 594 XS_MUTEX_UNLOCK(xs_status);
590 XSDEBUG("ok\n"); 595 XSDEBUG("ok\n");
591 } 596 }
879 */ 884 */
880 void xs_get_song_info(gchar * songFilename, gchar ** songTitle, gint * songLength) 885 void xs_get_song_info(gchar * songFilename, gchar ** songTitle, gint * songLength)
881 { 886 {
882 XSTuneInfo *info; 887 XSTuneInfo *info;
883 888
889 if (xs_status.engine == NULL)
890 return;
891
884 XS_MUTEX_LOCK(xs_status); 892 XS_MUTEX_LOCK(xs_status);
885 893
886 /* Get tune information from emulation engine */ 894 /* Get tune information from emulation engine */
887 info = xs_status.engine->plrGetSIDInfo(songFilename); 895 info = xs_status.engine->plrGetSIDInfo(songFilename);
888 if (!info) { 896 if (!info) {