mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-01-18 23:11:38 +00:00
[gamecode] Bail if PR_SearchDefs is given 0 defs
Fixes the hang when searching for a field in progs that don't have any.
This commit is contained in:
parent
c8e45c6cfc
commit
b544a052bf
1 changed files with 3 additions and 0 deletions
|
@ -51,6 +51,9 @@ PR_SearchDefs (pr_def_t *defs, unsigned num_defs, pointer_t offset)
|
||||||
unsigned right = num_defs - 1;
|
unsigned right = num_defs - 1;
|
||||||
unsigned mid;
|
unsigned mid;
|
||||||
|
|
||||||
|
if (!num_defs) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
while (left != right) {
|
while (left != right) {
|
||||||
mid = (left + right + 1) / 2;
|
mid = (left + right + 1) / 2;
|
||||||
if (defs[mid].ofs > offset) {
|
if (defs[mid].ofs > offset) {
|
||||||
|
|
Loading…
Reference in a new issue