diff --git a/aegisub/src/dialog_kara_timing_copy.cpp b/aegisub/src/dialog_kara_timing_copy.cpp index 903f8223a..a256d3abe 100644 --- a/aegisub/src/dialog_kara_timing_copy.cpp +++ b/aegisub/src/dialog_kara_timing_copy.cpp @@ -481,7 +481,7 @@ void KaraokeLineMatchDisplay::AutoMatchJapanese() // Eat all whitespace at the start of the destination. if (StringEmptyOrWhitespace(src)) { - while (IsWhitespace(unmatched_destination[destination_sel_length])) + while (destination_sel_length < unmatched_destination.size() && IsWhitespace(unmatched_destination[destination_sel_length])) ++destination_sel_length; // Now we've eaten all spaces in the destination as well // so the selection lengths should be good