forked from mia/Aegisub
Fix crash when seeking to previous keyframe with no keyframes loaded
Originally committed to SVN as r6305.
This commit is contained in:
parent
9ac2f93bf0
commit
8cf71ddd8d
1 changed files with 7 additions and 2 deletions
|
@ -451,9 +451,14 @@ struct video_frame_prev_keyframe : public validator_video_loaded {
|
||||||
STR_HELP("Seek to the previous keyframe.")
|
STR_HELP("Seek to the previous keyframe.")
|
||||||
|
|
||||||
void operator()(agi::Context *c) {
|
void operator()(agi::Context *c) {
|
||||||
int frame = c->videoController->GetFrameN();
|
|
||||||
std::vector<int> const& kf = c->videoController->GetKeyFrames();
|
std::vector<int> const& kf = c->videoController->GetKeyFrames();
|
||||||
std::vector<int>::const_iterator pos = lower_bound(kf.begin(), kf.end(), frame);
|
if (kf.empty()) {
|
||||||
|
c->videoController->JumpToFrame(0);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<int>::const_iterator pos =
|
||||||
|
lower_bound(kf.begin(), kf.end(), c->videoController->GetFrameN());
|
||||||
|
|
||||||
if (pos != kf.begin())
|
if (pos != kf.begin())
|
||||||
--pos;
|
--pos;
|
||||||
|
|
Loading…
Reference in a new issue