Skip to content

Expression: vector subscript out of range #17

@TheEeveeLovers

Description

@TheEeveeLovers

When I try to load captions, the parser doesn't even start because of the following error:
image
Call Stack:

>	SRTSynchedLyrics.exe!std::vector<std::string,std::allocator<std::string>>::operator[](const unsigned __int64 _Pos) Line 1948	C++
 	SRTSynchedLyrics.exe!SubtitleItem::timeMSec(std::string value) Line 313	C++
 	SRTSynchedLyrics.exe!SubtitleItem::SubtitleItem(int subNo, std::string startTime, std::string endTime, std::string text, bool ignore, std::string justDialogue, int speakerCount, int nonDialogueCount, int styleTagCount, int wordCount, std::vector<std::string,std::allocator<std::string>> speaker, std::vector<std::string,std::allocator<std::string>> nonDialogue, std::vector<std::string,std::allocator<std::string>> styleTags, std::vector<std::string,std::allocator<std::string>> word) Line 286	C++
 	SRTSynchedLyrics.exe!SubRipParser::parse(std::string fileName) Line 248	C++
 	SRTSynchedLyrics.exe!SubRipParser::SubRipParser(std::string fileName) Line 262	C++
 	SRTSynchedLyrics.exe!SubtitleParserFactory::getParser() Line 155	C++
 	SRTSynchedLyrics.exe!LoadCaptions(std::string filePath) Line 35	C++
 	SRTSynchedLyrics.exe!startup() Line 212	C++
 	SRTSynchedLyrics.exe!SDL_main(int argc, char * * args) Line 223	C++
 	SRTSynchedLyrics.exe!main_getcmdline() Line 82	C
 	[External Code]	

Code:

void LoadCaptions(std::string filePath) {
	SubtitleParserFactory* subParserFactory = new SubtitleParserFactory(filePath);
	SubtitleParser* parser = subParserFactory->getParser(); // Error suspect
	// More code that doesn't get run due to error
}

LoadCaptions("12 All Apologies 1.srt");

SRT File: (zipped so it can upload to GitHub)
12 All Apologies 1.zip
For reference, this file works completely fine in VLC.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions