diff options
-rw-r--r-- | apps/bookmark.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/apps/bookmark.c b/apps/bookmark.c index 08f63469aa..f76edd256e 100644 --- a/apps/bookmark.c +++ b/apps/bookmark.c | |||
@@ -290,14 +290,17 @@ static bool add_bookmark(const char* bookmark_file_name, | |||
290 | uint32_t pl_hash, pl_track_hash; | 290 | uint32_t pl_hash, pl_track_hash; |
291 | uint32_t bm_pl_hash, bm_pl_track_hash; | 291 | uint32_t bm_pl_hash, bm_pl_track_hash; |
292 | 292 | ||
293 | if (!bookmark) | ||
294 | return false; /* no bookmark */ | ||
295 | |||
293 | /* Opening up a temp bookmark file */ | 296 | /* Opening up a temp bookmark file */ |
294 | temp_bookmark_file = open_temp_bookmark(fnamebuf, | 297 | temp_bookmark_file = open_temp_bookmark(fnamebuf, |
295 | sizeof(fnamebuf), | 298 | sizeof(fnamebuf), |
296 | O_WRONLY | O_CREAT | O_TRUNC, | 299 | O_WRONLY | O_CREAT | O_TRUNC, |
297 | bookmark_file_name); | 300 | bookmark_file_name); |
298 | 301 | ||
299 | if (temp_bookmark_file < 0 || !bookmark) | 302 | if (temp_bookmark_file < 0) |
300 | return false; /* can't open the temp file or no bookmark */ | 303 | return false; /* can't open the temp file */ |
301 | 304 | ||
302 | if (most_recent && ((global_settings.usemrb == BOOKMARK_ONE_PER_PLAYLIST) | 305 | if (most_recent && ((global_settings.usemrb == BOOKMARK_ONE_PER_PLAYLIST) |
303 | || (global_settings.usemrb == BOOKMARK_ONE_PER_TRACK))) | 306 | || (global_settings.usemrb == BOOKMARK_ONE_PER_TRACK))) |
@@ -876,10 +879,10 @@ static bool delete_bookmark(const char* bookmark_file_name, int bookmark_id) | |||
876 | close(temp_bookmark_file); | 879 | close(temp_bookmark_file); |
877 | 880 | ||
878 | /* only retrieve the path*/ | 881 | /* only retrieve the path*/ |
879 | open_temp_bookmark(global_temp_buffer, | 882 | close(open_temp_bookmark(global_temp_buffer, |
880 | sizeof(global_temp_buffer), | 883 | sizeof(global_temp_buffer), |
881 | O_PATH, | 884 | O_PATH, |
882 | bookmark_file_name); | 885 | bookmark_file_name)); |
883 | 886 | ||
884 | remove(bookmark_file_name); | 887 | remove(bookmark_file_name); |
885 | rename(global_temp_buffer, bookmark_file_name); | 888 | rename(global_temp_buffer, bookmark_file_name); |