mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-13 00:24:12 +00:00
pr_load.c:
PR_RelocateBuiltins must be called before PR_InitRuntime pr_obj.c: don't segfault on broken classes
This commit is contained in:
parent
5cb79f423c
commit
548d3b68f8
2 changed files with 9 additions and 2 deletions
|
@ -281,6 +281,9 @@ PR_LoadProgs (progs_t *pr, const char *progsname, int edicts, int zone)
|
||||||
if (!pr->progs)
|
if (!pr->progs)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!PR_RelocateBuiltins (pr))
|
||||||
|
PR_Error (pr, "unable to load %s", progsname);
|
||||||
|
|
||||||
if (!PR_ResolveGlobals (pr))
|
if (!PR_ResolveGlobals (pr))
|
||||||
PR_Error (pr, "unable to load %s", progsname);
|
PR_Error (pr, "unable to load %s", progsname);
|
||||||
|
|
||||||
|
|
|
@ -145,8 +145,12 @@ finish_class (progs_t *pr, pr_class_t *class, pointer_t object_ptr)
|
||||||
|
|
||||||
meta->class_pointer = object_ptr;
|
meta->class_pointer = object_ptr;
|
||||||
if (class->super_class) {
|
if (class->super_class) {
|
||||||
val = Hash_Find (pr->classes, PR_GetString (pr,
|
const char *super_class = PR_GetString (pr, class->super_class);
|
||||||
class->super_class));
|
const char *class_name = PR_GetString (pr, class->name);
|
||||||
|
val = Hash_Find (pr->classes, super_class);
|
||||||
|
if (!val)
|
||||||
|
PR_Error (pr, "broken class %s: super class %s not found",
|
||||||
|
class_name, super_class);
|
||||||
meta->super_class = val->class_pointer;
|
meta->super_class = val->class_pointer;
|
||||||
class->super_class = POINTER_TO_PROG (pr, val);
|
class->super_class = POINTER_TO_PROG (pr, val);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue