Memory Access Violation

Blitz3D Forums/Blitz3D Programming/Memory Access Violation

I keep getting a Memory Access Violation with this bit of code on the ImagesCollide line. I just can't see where the problem is. Can anyone else spot it?
	;check collisions
	For thisBullet.bullettype = Each bullettype
		exitloop = False
		For thisship.shiptype = Each shiptype
			If thisship\ID = 2
				If ImagesCollide(thisbullet\image, thisbullet\bulletx, thisbullet\bullety, 0, thisship\image, thisship\shipx, thisship\shipy, 0)
					FreeImage thisBullet\image
					Delete thisBullet
					FreeImage thisship\image
					Delete thisship
					exitloop = True
				EndIf
			EndIf
			If exitloop = True Then Exit
		Next
	Next