Do an additional range check before grabbing a dialogue line by index in BaseGrid. Not doing it makes MSVC debug runtimes spew assertions and whatnot. This shouldn't break anything... I hope it doesn't.

Originally committed to SVN as r4134.
This commit is contained in:
Niels Martin Hansen 2010-02-21 01:25:15 +00:00
parent 5cafad1d81
commit 6a431b9032

View file

@ -972,6 +972,7 @@ void BaseGrid::SetColumnWidths() {
AssDialogue *BaseGrid::GetDialogue(int n) { AssDialogue *BaseGrid::GetDialogue(int n) {
try { try {
if (n < 0) return NULL; if (n < 0) return NULL;
if ((size_t)n >= diagMap.size()) return NULL;
AssEntry *e = *diagMap.at(n); AssEntry *e = *diagMap.at(n);
if (e->GetType() != ENTRY_DIALOGUE) return NULL; if (e->GetType() != ENTRY_DIALOGUE) return NULL;
return AssEntry::GetAsDialogue(e); return AssEntry::GetAsDialogue(e);