Solved some crashes when no music loaded
This commit is contained in:
@@ -113,23 +113,23 @@ void JA_PlayMusic(JA_Music music, const int loop) {
|
||||
}
|
||||
|
||||
void JA_PauseMusic() {
|
||||
if (current_music->state == JA_MUSIC_INVALID) return;
|
||||
if (current_music == NULL || current_music->state == JA_MUSIC_INVALID) return;
|
||||
current_music->state = JA_MUSIC_PAUSED;
|
||||
}
|
||||
|
||||
void JA_ResumeMusic() {
|
||||
if (current_music->state == JA_MUSIC_INVALID) return;
|
||||
if (current_music == NULL || current_music->state == JA_MUSIC_INVALID) return;
|
||||
current_music->state = JA_MUSIC_PLAYING;
|
||||
}
|
||||
|
||||
void JA_StopMusic() {
|
||||
if (current_music->state == JA_MUSIC_INVALID) return;
|
||||
if (current_music == NULL || current_music->state == JA_MUSIC_INVALID) return;
|
||||
current_music->pos = 0;
|
||||
current_music->state = JA_MUSIC_STOPPED;
|
||||
}
|
||||
|
||||
bool JA_IsMusicPlaying() {
|
||||
return current_music->state == JA_MUSIC_PLAYING;
|
||||
return current_music != NULL && current_music->state == JA_MUSIC_PLAYING;
|
||||
}
|
||||
|
||||
void JA_DeleteMusic(JA_Music music) {
|
||||
|
||||
Reference in New Issue
Block a user