Skip to content

Commit

Permalink
Fix a crash when attempting to edit lyrics on a track with none saved
Browse files Browse the repository at this point in the history
Fixes #387
  • Loading branch information
jacquesh committed Sep 1, 2024
1 parent ef91e0c commit 15f4141
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ void OpenLyricsVersion::get_about_message(pfc::string_base & out)
out += "You can support development at https://www.buymeacoffee.com/jacquesheunis\n";
out += "\nChangelog:\n";
// out += "Version " OPENLYRICS_VERSION " (" __DATE__ "):\n"
// "\n";
out += "Version 1.10.2 (2024-09-01):\n"
"- Fix a crash when attempting to edit lyrics on a track with none saved\n"
"\n";
out += "Version 1.10.1 (2024-08-30):\n"
"- Fix version 1.10 not having any version at all in the fb2k components UI\n"
"\n";
Expand Down
17 changes: 15 additions & 2 deletions src/ui_contextmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,21 @@ class OpenLyricsContextSubItem : public contextmenu_item_simple
bool success = search_handle.wait_for_complete(30'000);
if(success)
{
LyricData lyrics = search_handle.get_result();
lyric_metadata_log_retrieved(track_info, lyrics);
// If we don't already have lyrics for a track then search will return no results,
// so we need to construct our own blank lyric data
LyricData lyrics;
if(search_handle.has_result())
{
lyrics = search_handle.get_result();
lyric_metadata_log_retrieved(track_info, lyrics);
}
else
{
lyrics.artist = track_metadata(track_info, "artist");
lyrics.album = track_metadata(track_info, "album");
lyrics.title = track_metadata(track_info, "title");
lyrics.duration_sec = track_duration_in_seconds(track_info);
}

fb2k::inMainThread2([lyrics, track, track_info]()
{
Expand Down

0 comments on commit 15f4141

Please sign in to comment.