Hi Bogdan.
Bogdan:
> This small patch fixes some potential and real NullPointerExceptions.
Thanks for the patch. Some comments:
- if (at.equals(vt)) {
- // No new transform
…
+ if (at != null) {
+ if (at.equals(vt)) {
+ // No new transform
I can’t see how at can be null. AFAICT, calculateViewingTransform()
will always return an object.
- myCGN.setViewingTransform(myAT);
+ if (myCGN != null) myCGN.setViewingTransform(myAT);
For this one, yes, it seems myCGN can be null, if the GVT being
displayed in the component were messed with so that it doesn’t look
like:
CompositeGraphicsNode
+
|
+--CanvasGraphicsNode
+
:
since getCanvasGraphicsNode() will return null in this case.
JSVGComponent.setGraphicsNode(GraphicsNode,boolean) could also throw an
NPE if getCanvasGraphicsNode() returned null.
It seems a bit strange to allow messing with the GVT from outside the
JSVGComponent, but with the current design there’s not much we can do
about that, I think.
I’ve put the null check for the line in your patch and in
setGraphicsNode(GraphicsNode,boolean).
--
Cameron McCormack ≝ http://mcc.id.au/
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]