Fix overflow bug in Haiku frontend when the playback position ends up larger than the length
This commit is contained in:
parent
c2a971d225
commit
82c3a77f51
1 changed files with 3 additions and 1 deletions
|
@ -333,7 +333,9 @@ void HaikuLooperWindow::Pulse() {
|
||||||
auto len = playback->GetLength();
|
auto len = playback->GetLength();
|
||||||
auto pos = playback->GetPosition();
|
auto pos = playback->GetPosition();
|
||||||
auto pos_milliseconds = pos * 1000.0;
|
auto pos_milliseconds = pos * 1000.0;
|
||||||
int32_t pos_int32 = (int32_t)((((int64_t)pos_milliseconds) * INT32_MAX) / 1000 / len);
|
int64_t pos_int64 = (((int64_t)pos_milliseconds) * INT32_MAX) / 1000 / len;
|
||||||
|
if (pos_int64 > INT32_MAX) pos_int64 = INT32_MAX;
|
||||||
|
int32_t pos_int32 = (int32_t)pos_int64;
|
||||||
if (!seek_clicked) slider->SetValue(pos_int32);
|
if (!seek_clicked) slider->SetValue(pos_int32);
|
||||||
auto component_count = TimeToComponentCount(len);
|
auto component_count = TimeToComponentCount(len);
|
||||||
bool enable_ui = !playback->IsStopped();
|
bool enable_ui = !playback->IsStopped();
|
||||||
|
|
Loading…
Add table
Reference in a new issue