MainWindow: Bound volume between 0 and 100

Fixes #1262
This commit is contained in:
Jonas Kvinge 2023-08-30 21:43:52 +02:00
parent f81b725d42
commit 6dd79d5b8f
1 changed files with 2 additions and 2 deletions

View File

@ -2464,10 +2464,10 @@ void MainWindow::CommandlineOptionsReceived(const CommandlineOptions &options) {
AddToPlaylist(mimedata);
}
if (options.set_volume() != -1) app_->player()->SetVolume(options.set_volume());
if (options.set_volume() != -1) app_->player()->SetVolume(static_cast<uint>(qBound(0, options.set_volume(), 100)));
if (options.volume_modifier() != 0) {
app_->player()->SetVolume(app_->player()->GetVolume() + options.volume_modifier());
app_->player()->SetVolume(static_cast<uint>(qBound(0, static_cast<int>(app_->player()->GetVolume()) + options.volume_modifier(), 100)));
}
if (options.seek_to() != -1) {