Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix debug assertion when exporting invalid bpm as file tag #4063

Merged
merged 1 commit into from
Jul 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions src/track/taglib/trackmetadata_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,11 @@ inline TagLib::String uuidToTString(

inline QString formatBpm(
const TrackMetadata& trackMetadata) {
return Bpm::valueToString(
trackMetadata.getTrackInfo().getBpm().value());
const Bpm bpm = trackMetadata.getTrackInfo().getBpm();
if (!bpm.isValid()) {
return {};
}
return Bpm::valueToString(bpm.value());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we make valueToString a member of the Bpm class (bpm.toString()) and make the check internally?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably, because now the check is done twice.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's do this separately. I didn't check what else is affected and if it applies to other values.

}

bool parseBpm(
Expand Down