/* spawn the world entity */
prog->entitypool.emplace_back(true);
prog->entitydata.resize(prog->entityfields);
- memset(prog->entitydata.data(), 0, sizeof(prog->entitydata[0]) * prog->entityfields);
+ if (prog->entitydata.size())
+ memset(prog->entitydata.data(), 0, sizeof(prog->entitydata[0]) * prog->entityfields);
prog->entities = 1;
/* cache some globals and fields from names */
oldsp = prog->stack[prog->stack.size()-1].localsp;
#endif
if (prev) {
- qcint_t *globals = &prog->globals[0] + prev->firstlocal;
- memcpy(globals, &prog->localstack[oldsp], prev->locals * sizeof(prog->localstack[0]));
+ if (prev->locals) {
+ qcint_t *globals = &prog->globals[0] + prev->firstlocal;
+ memcpy(globals, &prog->localstack[oldsp], prev->locals * sizeof(prog->localstack[0]));
+ }
prog->localstack.resize(oldsp);
}