[GRASS-SVN] r33671 - grass/branches/develbranch_6/lib/init

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Oct 4 12:23:02 EDT 2008


Author: pkelly
Date: 2008-10-04 12:23:02 -0400 (Sat, 04 Oct 2008)
New Revision: 33671

Modified:
   grass/branches/develbranch_6/lib/init/gis_set.tcl
Log:
Don't crash when there are no accessible mapsets


Modified: grass/branches/develbranch_6/lib/init/gis_set.tcl
===================================================================
--- grass/branches/develbranch_6/lib/init/gis_set.tcl	2008-10-04 10:15:58 UTC (rev 33670)
+++ grass/branches/develbranch_6/lib/init/gis_set.tcl	2008-10-04 16:23:02 UTC (rev 33671)
@@ -573,10 +573,9 @@
     if { [CheckLocation] } {
         # setting list of mapsets
 	refresh_ms
-        selFromList .frame0.frameMS.listbox $mapset
-	if { [.frame0.frameMS.listbox get [.frame0.frameMS.listbox curselection]] == $mapset } {
-	        .frame0.frameBUTTONS.ok configure -state normal
-		}
+	if { [selFromList .frame0.frameMS.listbox $mapset] } {
+		.frame0.frameBUTTONS.ok configure -state normal
+	}
     }
 
 	bind .frame0.frameDB.mid.entry <Return> {
@@ -756,16 +755,21 @@
 proc selFromList { lis str } {
 # Selects list entry, if there is match
   set siz [$lis size]
-  set curSelected 0
+  set curSelected ""
   for { set x 0 } { $x < $siz } { incr x } {
         if { $str == [$lis get $x] } {
 	        set curSelected $x
 		break
 	}
   }
-  $lis yview $curSelected
-  $lis selection clear 0 end
-  $lis select set $curSelected
+  if { $curSelected != "" } {
+  	$lis yview $curSelected
+  	$lis selection clear 0 end
+  	$lis select set $curSelected
+	return 1
+  } else {
+  	return 0
+  }
 }
 
 #############################################################################



More information about the grass-commit mailing list