Skip to content

Commit

Permalink
duration: clamp progress between 0 and 1
Browse files Browse the repository at this point in the history
Avoid UB if it goes above 1.
  • Loading branch information
ammen99 committed Apr 4, 2024
1 parent ba5ead7 commit c84e30b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/duration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class wf::animation::duration_t::impl
progress = 1.0 - progress;
}

return progress;
return std::clamp(progress, 0.0, 1.0);
}

double progress() const
Expand Down

0 comments on commit c84e30b

Please sign in to comment.