Closed renyuneyun closed 4 years ago
Hi @renyuneyun we couldn't reproduce the issue. Can you post the stacktrace or example code of this issue.
However, I'm pretty confused why the drawEdges() method is defined with a graph parameter but the body uses this.graph instead...
This is intended, because the Sugiyama algorithm needs to change the graph to work.
Here is the stacktrace:
java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List de.blox.graphview.Graph.getEdges()' on a null object reference
at de.blox.graphview.layered.SugiyamaEdgeRenderer.render(SugiyamaEdgeRenderer.java:32)
at de.blox.graphview.layered.SugiyamaAlgorithm.drawEdges(SugiyamaAlgorithm.java:852)
at de.blox.graphview.GraphNodeContainerView.dispatchDraw(GraphNodeContainerView.java:304)
at android.view.View.updateDisplayListIfDirty(View.java:19232)
at android.view.View.draw(View.java:20094)
at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
at com.otaliastudios.zoom.ZoomLayout.drawChild(ZoomLayout.kt:163)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4116)
at android.view.View.draw(View.java:20369)
at android.view.View.updateDisplayListIfDirty(View.java:19241)
at android.view.View.draw(View.java:20094)
at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4116)
at android.view.View.updateDisplayListIfDirty(View.java:19232)
at android.view.View.draw(View.java:20094)
at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4116)
at android.view.View.updateDisplayListIfDirty(View.java:19232)
at android.view.View.draw(View.java:20094)
at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
at androidx.coordinatorlayout.widget.CoordinatorLayout.drawChild(CoordinatorLayout.java:1246)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4116)
at android.view.View.draw(View.java:20369)
at android.view.View.updateDisplayListIfDirty(View.java:19241)
at android.view.View.draw(View.java:20094)
at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
at androidx.drawerlayout.widget.DrawerLayout.drawChild(DrawerLayout.java:1426)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4116)
at android.view.View.draw(View.java:20369)
at android.view.View.updateDisplayListIfDirty(View.java:19241)
at android.view.View.draw(View.java:20094)
at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4116)
at android.view.View.updateDisplayListIfDirty(View.java:19232)
at android.view.View.draw(View.java:20094)
at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4116)
at android.view.View.updateDisplayListIfDirty(View.java:19232)
at android.view.View.draw(View.java:20094)
at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4116)
at android.view.View.updateDisplayListIfDirty(View.java:19232)
at android.view.View.draw(View.java:20094)
at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4116)
at android.view.View.updateDisplayListIfDirty(View.java:19232)
at android.view.View.draw(View.java:20094)
at android.view.ViewGroup.drawChild(ViewGroup.java:4337)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4116)
at android.view.View.draw(View.java:20369)
at com.android.internal.policy.DecorView.draw(DecorView.java:781)
at android.view.View.updateDisplayListIfDirty(View.java:19241)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:690)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:696)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:805)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:3526)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3316)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2685)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1637)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7797)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1172)
at android.view.Choreographer.doCallbacks(Choreographer.java:984)
This should be fixed in version 0.6.1. Sorry it took so long, but we had a lot of work to do.
This error appears when I (my app) tried to draw an empty graph with
SugiyamaAlgorithm
.The error thrown is
java.lang.NullPointerException: Attempt to invoke virtual method 'java.util.List de.blox.graphview.Graph.getEdges()' on a null object reference
. Digging into the source code of ths library, it's because thedrawEdges()
method being called whenthis.graph == null
.However, I'm pretty confused why the
drawEdges()
method is defined with agraph
parameter but the body usesthis.graph
instead...(It seem
drawEdges()
is the only one resulting in serious problems. The only other method being called beforerun()
is called isgetGraphSize()
, which will return the defaultSize size = new Size(0, 0);
)