Commit fa737592c128beaa30e8e0b3e55164abc2a95259

Authored by David Mayerich
1 parent f7e99517

fixed a bug that made edge radii undefined when edges were zero length

Showing 1 changed file with 6 additions and 1 deletions   Show diff stats
stim/biomodels/network.h
... ... @@ -105,7 +105,12 @@ class network{
105 105 }
106 106  
107 107 length = length_sum; //store the total length
108   - return radius_sum / length; //return the average radius of the fiber
  108 +
  109 + //if the total length is zero, store a radius of zero
  110 + if(length == 0)
  111 + return 0;
  112 + else
  113 + return radius_sum / length; //return the average radius of the fiber
109 114 }
110 115  
111 116 std::string str(){
... ...