[GRASS-SVN] r43875 - grass/branches/develbranch_6/lib/vector/dglib

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Oct 12 04:24:27 EDT 2010


Author: mmetz
Date: 2010-10-12 01:24:27 -0700 (Tue, 12 Oct 2010)
New Revision: 43875

Modified:
   grass/branches/develbranch_6/lib/vector/dglib/sp-template.c
Log:
attempted fix for BUG2 (backport from trunk r43874)

Modified: grass/branches/develbranch_6/lib/vector/dglib/sp-template.c
===================================================================
--- grass/branches/develbranch_6/lib/vector/dglib/sp-template.c	2010-10-12 08:23:45 UTC (rev 43874)
+++ grass/branches/develbranch_6/lib/vector/dglib/sp-template.c	2010-10-12 08:24:27 UTC (rev 43875)
@@ -70,6 +70,7 @@
 				      dglInt32_t nStart,
 				      dglInt32_t nDestination)
 {
+    dglTreeTouchI32_s VisitedItem;
     dglTreePredist_s *pPredistItem, PredistItem;
 
     if (pCache->nStartNode != nStart) {
@@ -77,9 +78,15 @@
 	return -pgraph->iErrno;
     }
 
+    VisitedItem.nKey = nDestination;
+    if (avl_find(pCache->pvVisited, &VisitedItem) == NULL) {
+	pgraph->iErrno = DGL_ERR_TailNodeNotFound;
+	return -pgraph->iErrno;
+    }
+
     PredistItem.nKey = nDestination;
     if ((pPredistItem = avl_find(pCache->pvPredist, &PredistItem)) == NULL) {
-	pgraph->iErrno = DGL_ERR_TailNodeNotFound;
+	pgraph->iErrno = DGL_ERR_UnexpectedNullPointer;
 	return -pgraph->iErrno;
     }
 
@@ -93,6 +100,7 @@
 					       dglInt32_t nStart,
 					       dglInt32_t nDestination)
 {
+    dglTreeTouchI32_s VisitedItem;
     dglTreePredist_s *pPredistItem, PredistItem;
     dglInt32_t *pEdge;
     dglInt32_t *pDestination;
@@ -107,10 +115,15 @@
 	return NULL;
     }
 
+    VisitedItem.nKey = nDestination;
+    if (avl_find(pCache->pvVisited, &VisitedItem) == NULL) {
+	pgraph->iErrno = DGL_ERR_TailNodeNotFound;
+	return NULL;
+    }
+
     PredistItem.nKey = nDestination;
-
     if (avl_find(pCache->pvPredist, &PredistItem) == NULL) {
-	pgraph->iErrno = DGL_ERR_TailNodeNotFound;
+	pgraph->iErrno = DGL_ERR_UnexpectedNullPointer;
 	return NULL;
     }
 



More information about the grass-commit mailing list