Closed QuaverJosh closed 2 years ago
I have ran into this same issue, that we had some items checked to see if they had a common parent before being added to the stage, to check for collisions. It shouldn't happen but it would be good if it didn't throw a null safe error. Even throwing an exception of no same parent would be good.
I have applied this fix to the repository, and will upload to pub soon.
Consider the following use case:
When run, this will throw a runtime unexpected null error due to obj1 being set to null during the first while loop:
You can get around this error by ensuring
tempHighlight.addTo(stage!)
is called before callingtempHighlight.getTransformationMatrix(item.stage!);
but I believe the correct place for these edits is in the_getCommonAncestor
method itself, by allowing obj1 and obj2 to be nullable:This removes the requirement that tempHighlight be added to the stage before getTransformationMatrix is called, which matches the behavior of previous versions of StageXL.