My blind guess from your story is that, sometimes passed "elem" cannot be cast to FlowLeafElement and this leads to have a null instead..
That was my best guess too (even though that really should be throwing an
error at the function call itself), but the object is always of the exact
same class so I don't see how that could be it.
Another guess is that FP GC collects your object if you have too few references to it, or have them as local variables, references from local variables to that object will not protect it from being collected, the only way is to assign this object to class property or put it into an Array or something else more efficient, btw Flex 4 and TextLayoutFramework are still in beta, who knows how many surprises are still there
I'm personally keeping my hands OFF F4 before release and probably upcoming SP1 ))