Index: gearhead-1.100/gears.pp
===================================================================
--- gearhead-1.100.orig/gears.pp	2010-02-10 22:05:01.000000000 +0200
+++ gearhead-1.100/gears.pp	2010-02-10 22:05:11.000000000 +0200
@@ -387,7 +387,7 @@
 	Code := UpCase(Code_In);
 
 	{Check through all the SAtts looking for the SATT in question.}
-	while LList <> Nil do begin
+	while ( LList <> Nil ) and ( it = Nil ) do begin
 		if LabelsMatch( LList^.info , Code ) then it := LList;
 		LList := LList^.Next;
 	end;
@@ -724,7 +724,7 @@
 	it := Nil;
 
 	{Loop through all the elements.}
-	while LList <> Nil do begin
+	while ( LList <> Nil ) and ( it = Nil ) do begin
 		if (LList^.G = G) and (LList^.S = S) then it := LList;
 		LList := LList^.Next;
 	end;
