diff options
author | jandegr <jandegr@users.noreply.github.com> | 2017-05-03 16:12:05 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-03 16:12:05 +0200 |
commit | 602ab4fb0f787c43246fe5935dea2e1d527a15da (patch) | |
tree | 8f2752a3d9151f95eb1e6cf1b6e700dea07619b1 | |
parent | bdfb54f66d3dfe10247334102f022d0464d3aec9 (diff) | |
parent | 3084615ff7e39b531316545461b272c128bc75a5 (diff) | |
download | navit-602ab4fb0f787c43246fe5935dea2e1d527a15da.tar.gz |
Merge pull request #218 from mcapdeville/navigationR7445
Catching division by zero is ok, the duplicate checks were intended to catch duplicates in the OSM data and duplicates caused by the turn restriction processing so an incorrect navigation resulting from overlapping binfiles is accepted, at least if it does not crash it.
-rw-r--r-- | navit/navigation.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/navit/navigation.c b/navit/navigation.c index cdad6331c..964b6bf17 100644 --- a/navit/navigation.c +++ b/navit/navigation.c @@ -2486,7 +2486,12 @@ void navigation_analyze_roundabout(struct navigation *this_, struct navigation_c * The central angle is approximated using the unweighted average of delta1 and delta2, * which is somewhat crude but sufficient for our purposes. */ central_angle = abs((delta1 + delta2) / 2 + ((cmd->delta < dtsir) ? 180 : -180)); - roundabout_length = len * 360 / central_angle; + if (central_angle) + roundabout_length = len * 360 / central_angle; + else { + dbg(lvl_error,"central_angle in roundabout_length computation lead to divide by zero (delta1 = %d, delta2 = %d, cmd->delta = %d, dtsir = %d, len = %d)",delta1,delta2,cmd->delta,dtsir,len); + roundabout_length = len; + } dbg(lvl_debug,"roundabout_length = %dm (for central_angle = %d degrees)\n", roundabout_length, central_angle); /* in the case of separate carriageways, approach roads become hard to identify, thus we keep a cap on distance. |