the mysterious hanging code

BlitzMax Forums/BlitzMax Programming/the mysterious hanging code

Pineapple(Posted 2012) [#1]
I've got this bit of code I've written.



it is not consistent, but with the random seed set to 0 like it is, it *usually* hangs immediately before the line Return [xv,yv] inside the method getvelocity#[](when%), at least on my computer

the imported files:

mergelists.bmx


interpolate.bmx


colorspace.bmx


what on earth is making it do this? I've debugged it to hell and back and can't figure it out.


col(Posted 2012) [#2]
Hiya,

The problem seems to be in the ListAppendList function.
Is there any reason you don't use this version by the same author...
Function ListAppendList:Int(dest:TList, from:TList)
	If dest = Null Or from = Null Or from.Count() = 0 Then Return False
	For Local obj:Object = EachIn from
		dest.AddLast(obj)
	Next
	Return True
End Function



Pineapple(Posted 2012) [#3]
well, now I feel silly.

why on earth wasn't it behaving the same? shouldn't count()=0 be exactly the same as isempty(), just without the whole iterating through the entire list?