mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 20:29:57 +00:00
Replace another assert
with a throw
It fixes the following crash: ```nasm [----------------------------------registers-----------------------------------] RAX: 0xffffffffffffffe4 RBX: 0x7fffffffbd88 --> 0x0 RCX: 0x555555861f01 --> 0xd6000055555582fa RDX: 0x1 RSI: 0x0 RDI: 0xff RBP: 0x2e94 RSP: 0x7fffffff9bb0 --> 0x0 RIP: 0x55555574e286 (<_ZN4ESM44Cell4loadERNS_6ReaderE+182>: mov eax,DWORD PTR [rax+0xc]) R8 : 0x0 R9 : 0x555555836bd0 --> 0x555555861f90 --> 0x100000000000000 R10: 0xffffffff R11: 0x0 R12: 0x7fffffffbd88 --> 0x0 R13: 0x7fffffffbd30 --> 0x7fffffffbd28 --> 0xff0001 R14: 0x7fffffff9da0 --> 0x10fc R15: 0x7fffffff9ea8 --> 0x7fffffff9eb8 --> 0x0 EFLAGS: 0x10206 (carry PARITY adjust zero sign trap INTERRUPT direction overflow) [-------------------------------------code-------------------------------------] 0x55555574e27c <_ZN4ESM44Cell4loadERNS_6ReaderE+172>: mov rdi,r12 0x55555574e27f <_ZN4ESM44Cell4loadERNS_6ReaderE+175>: xor esi,esi 0x55555574e281 <_ZN4ESM44Cell4loadERNS_6ReaderE+177>: call 0x5555557edfb0 <_ZNK4ESM46Reader3grpEm> => 0x55555574e286 <_ZN4ESM44Cell4loadERNS_6ReaderE+182>: mov eax,DWORD PTR [rax+0xc] 0x55555574e289 <_ZN4ESM44Cell4loadERNS_6ReaderE+185>: cmp eax,0xff 0x55555574e28e <_ZN4ESM44Cell4loadERNS_6ReaderE+190>: ja 0x55555574e314 <_ZN4ESM44Cell4loadERNS_6ReaderE+324> 0x55555574e294 <_ZN4ESM44Cell4loadERNS_6ReaderE+196>: cmp al,0x5 0x55555574e296 <_ZN4ESM44Cell4loadERNS_6ReaderE+198>: jne 0x55555574e314 <_ZN4ESM44Cell4loadERNS_6ReaderE+324> [------------------------------------stack-------------------------------------] 0000| 0x7fffffff9bb0 --> 0x0 0008| 0x7fffffff9bb8 --> 0x0 0016| 0x7fffffff9bc0 --> 0x0 0024| 0x7fffffff9bc8 --> 0x0 0032| 0x7fffffff9bd0 --> 0x0 0040| 0x7fffffff9bd8 --> 0x0 0048| 0x7fffffff9be0 --> 0x0 0056| 0x7fffffff9be8 --> 0x0 [------------------------------------------------------------------------------] Legend: code, data, rodata, value Stopped reason: SIGSEGV 0x000055555574e286 in ESM4::Cell::load (this=0x7fffffff9da0, reader=...) at /home/jvoisin/dev/openmw/openmw/components/esm4/loadcell.cpp:68 68 if (reader.grp().type == ESM4::Grp_ExteriorSubCell && reader.grp().label.grid[1] == 0 gdb-peda$ bt this=<optimized out>, reader=...) at /home/jvoisin/dev/openmw/openmw/apps/esmtool/tes4.cpp:547 recordInvocable=...) at /home/jvoisin/dev/openmw/openmw/./components/esm4/readerutils.hpp:31 at /home/jvoisin/dev/openmw/openmw/./components/esm4/readerutils.hpp:23 at ../csu/libc-start.c:381 ```
This commit is contained in:
parent
364bc91f5b
commit
534e20cf3a
1 changed files with 4 additions and 1 deletions
|
@ -527,7 +527,10 @@ namespace ESM4
|
||||||
// else the method may try to dereference an element that does not exist
|
// else the method may try to dereference an element that does not exist
|
||||||
const GroupTypeHeader& Reader::grp(std::size_t pos) const
|
const GroupTypeHeader& Reader::grp(std::size_t pos) const
|
||||||
{
|
{
|
||||||
assert(pos <= mCtx.groupStack.size() - 1 && "ESM4::Reader::grp - exceeded stack depth");
|
if (mCtx.groupStack.size() == 0)
|
||||||
|
throw std::runtime_error("ESM4::Reader::grp mCtx.groupStack.size is zero");
|
||||||
|
if (pos <= mCtx.groupStack.size() - 1)
|
||||||
|
throw std::runtime_error("ESM4::Reader::grp - exceeded stack depth");
|
||||||
|
|
||||||
return (*(mCtx.groupStack.end() - pos - 1)).first;
|
return (*(mCtx.groupStack.end() - pos - 1)).first;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue