From: <qto...@us...> - 2007-10-24 07:46:47
|
Revision: 532 http://viking.svn.sourceforge.net/viking/?rev=532&view=rev Author: qtonthat Date: 2007-10-24 00:46:50 -0700 (Wed, 24 Oct 2007) Log Message: ----------- Fix a bug that caused crashes when displaying elev graph for some track. Crashes on tracks which have total length of 0. For examples, tracks which consist only 2 trackpoints of the same location. The problem is now fixed. Signed-off-by: Quy Tonthat <qto...@gm...> Modified Paths: -------------- trunk/src/viktrack.c Modified: trunk/src/viktrack.c =================================================================== --- trunk/src/viktrack.c 2007-10-22 23:09:50 UTC (rev 531) +++ trunk/src/viktrack.c 2007-10-24 07:46:50 UTC (rev 532) @@ -368,6 +368,10 @@ total_length = vik_track_get_length_including_gaps ( tr ); chunk_length = total_length / num_chunks; + /* Zero chunk_length (eg, track of 2 tp with the same loc) will cause crash */ + if (chunk_length <= 0) + return NULL; + current_dist = 0.0; current_area_under_curve = 0; current_chunk = 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |