Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix bug when frlayout is started with zero nodes.

  • Loading branch information...
commit 0f2645cbbda2976ef574de96d6c142036f992e36 1 parent 711319d
chebee7i authored
Showing with 7 additions and 1 deletion.
  1. +7 −1 src/layout/frlayout.cpp
8 src/layout/frlayout.cpp
View
@@ -27,7 +27,13 @@ FruchtermanReingoldLayout::FruchtermanReingoldLayout(Mycelia* application)
void* FruchtermanReingoldLayout::layout()
{
- springForceConstant = Math::pow(VOLUME / application->g->getNodeCount(), 1.0 / 3.0);
+ int numNodes = application->g->getNodeCount();
+ if (numNodes == 0)
+ {
+ stopped = true;
+ return 0;
+ }
+ springForceConstant = Math::pow(VOLUME / numNodes, 1.0 / 3.0);
for(remainingIterations = MAX_ITERATIONS; remainingIterations > 0 && !stopped; remainingIterations--)
{
Please sign in to comment.
Something went wrong with that request. Please try again.