assert song->url != NULL
This commit is contained in:
		| @@ -39,6 +39,9 @@ int playerWait(int fd) | |||||||
|  |  | ||||||
| static void set_current_song(Song *song) | static void set_current_song(Song *song) | ||||||
| { | { | ||||||
|  | 	assert(song != NULL); | ||||||
|  | 	assert(song->url != NULL); | ||||||
|  |  | ||||||
| 	pc.fileTime = song->tag ? song->tag->time : 0; | 	pc.fileTime = song->tag ? song->tag->time : 0; | ||||||
| 	pc.next_song = song; | 	pc.next_song = song; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -69,6 +69,7 @@ static int waitOnDecode(int *decodeWaitedOn) | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	if (dc.error != DECODE_ERROR_NOERROR) { | 	if (dc.error != DECODE_ERROR_NOERROR) { | ||||||
|  | 		assert(dc.next_song == NULL || dc.next_song->url != NULL); | ||||||
| 		pc.errored_song = dc.next_song; | 		pc.errored_song = dc.next_song; | ||||||
| 		pc.error = PLAYER_ERROR_FILE; | 		pc.error = PLAYER_ERROR_FILE; | ||||||
| 		return -1; | 		return -1; | ||||||
| @@ -148,6 +149,7 @@ static void processDecodeInput(int *pause_r, unsigned int *bbp_r, | |||||||
| 				pc.state = PLAYER_STATE_PLAY; | 				pc.state = PLAYER_STATE_PLAY; | ||||||
| 			} else { | 			} else { | ||||||
| 				char tmp[MPD_PATH_MAX]; | 				char tmp[MPD_PATH_MAX]; | ||||||
|  | 				assert(dc.next_song == NULL || dc.next_song->url != NULL); | ||||||
| 				pc.errored_song = dc.next_song; | 				pc.errored_song = dc.next_song; | ||||||
| 				pc.error = PLAYER_ERROR_AUDIO; | 				pc.error = PLAYER_ERROR_AUDIO; | ||||||
| 				ERROR("problems opening audio device " | 				ERROR("problems opening audio device " | ||||||
| @@ -246,6 +248,7 @@ static void decodeParent(void) | |||||||
| 				decodeWaitedOn = 0; | 				decodeWaitedOn = 0; | ||||||
| 				if(openAudioDevice(&(ob.audioFormat))<0) { | 				if(openAudioDevice(&(ob.audioFormat))<0) { | ||||||
| 					char tmp[MPD_PATH_MAX]; | 					char tmp[MPD_PATH_MAX]; | ||||||
|  | 					assert(dc.next_song == NULL || dc.next_song->url != NULL); | ||||||
| 					pc.errored_song = dc.next_song; | 					pc.errored_song = dc.next_song; | ||||||
| 					pc.error = PLAYER_ERROR_AUDIO; | 					pc.error = PLAYER_ERROR_AUDIO; | ||||||
| 					ERROR("problems opening audio device " | 					ERROR("problems opening audio device " | ||||||
| @@ -266,6 +269,7 @@ static void decodeParent(void) | |||||||
| 			} | 			} | ||||||
| 			else if(dc.state!=DECODE_STATE_START) { | 			else if(dc.state!=DECODE_STATE_START) { | ||||||
| 				/* the decoder failed */ | 				/* the decoder failed */ | ||||||
|  | 				assert(dc.next_song == NULL || dc.next_song->url != NULL); | ||||||
| 				pc.errored_song = dc.next_song; | 				pc.errored_song = dc.next_song; | ||||||
| 				pc.error = PLAYER_ERROR_FILE; | 				pc.error = PLAYER_ERROR_FILE; | ||||||
| 				break; | 				break; | ||||||
|   | |||||||
| @@ -316,6 +316,9 @@ char *get_song_url(char *path_max_tmp, Song *song) | |||||||
| { | { | ||||||
| 	if (!song) | 	if (!song) | ||||||
| 		return NULL; | 		return NULL; | ||||||
|  |  | ||||||
|  | 	assert(song->url != NULL); | ||||||
|  |  | ||||||
| 	if (!song->parentDir || !song->parentDir->path) | 	if (!song->parentDir || !song->parentDir->path) | ||||||
| 		strcpy(path_max_tmp, song->url); | 		strcpy(path_max_tmp, song->url); | ||||||
| 	else | 	else | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Max Kellermann
					Max Kellermann