Cyclic Prevention...

BlitzMax Forums/BlitzMax Programming/Cyclic Prevention...

Design your logic to avoid this. There's not any fixed rule that fixes the issue automagically.
There's one possibility:
Method SecurePointTo(MyObj:TMyClass)
?debug
    Local Obj:TMyClass = MyObj
    Local Cycles:int = 0
    While Obj.Pointer<>null then
        If Obj.Pointer = self then
            throw "cycle found"
        End if
        Obj = Obj.Pointer
        Cycles:+1
        if cycles >=100000 then
            throw "too many branches. Process stoped for security"
        end if
    Wend
?
    self.Pointer = MyObj
End method

This is a security code that could work, for a certain type, suposing that the field Pointer is used to create the potentially cyclic dependencie.
Not the best code in the world, but it could be usefull while designing the object for a given application.
Not tested, as I'm not on my code machine right now. Just to give an idea!