pathfind.c
changeset 979 f12f96116cdd
parent 926 bd4312619522
child 1034 ff54f189424b
--- a/pathfind.c	Mon Jan 10 21:56:02 2005 +0000
+++ b/pathfind.c	Mon Jan 10 22:14:35 2005 +0000
@@ -450,7 +450,7 @@
 	HashLink *new_link;
 	uint num_links_left;
 
-	int nstack;
+	uint nstack;
 	StackedItem stack[256]; // priority queue of stacked items
 
 	uint16 hash_head[0x400]; // hash heads. 0 means unused. 0xFFC0 = length, 0x3F = type
@@ -484,7 +484,10 @@
 {
 	StackedItem si;
 	int i = 1, j;
-	int n = --tpf->nstack;
+	int n;
+
+	assert(tpf->nstack > 0);
+	n = --tpf->nstack;
 
 	if (n == 0) return; // heap is empty so nothing to do?