summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/playlist_viewer.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index 087bdd1583..6c21cc4a99 100644
--- a/apps/playlist_viewer.c
+++ b/apps/playlist_viewer.c
@@ -357,18 +357,16 @@ static void format_name(char* dest, const char* src)
357 case 0: 357 case 0:
358 default: 358 default:
359 { 359 {
360 /* Only display the mp3 filename */ 360 /* Only display the filename */
361 char* p = strrchr(src, '/'); 361 char* p = strrchr(src, '/');
362 int len;
363 362
364 strcpy(dest, p+1); 363 strcpy(dest, p+1);
365 len = strlen(dest);
366 364
367 /* Remove the extension */ 365 /* Remove the extension */
368 if (!strcasecmp(&dest[len-4], ".mp3") || 366 char* q = strrchr(dest, '.');
369 !strcasecmp(&dest[len-4], ".mp2") || 367
370 !strcasecmp(&dest[len-4], ".mpa")) 368 if (q != NULL)
371 dest[len-4] = '\0'; 369 *q = '\0';
372 370
373 break; 371 break;
374 } 372 }