# [PATCH v2] git-gui: Error on systems with TK < 8.6.0

1 messages from 2017-03-31 to 2017-03-31. Participants: Peter van der Does.
Thread: https://gitlist.dev/t/45571

## Peter van der Does, 2017-03-31 18:36

Subject: [PATCH v2] git-gui: Error on systems with TK < 8.6.0
Message-ID: <ca09fdf0-43e5-0bc6-1fe1-9331e3820d6a@avirtualhome.com>
URL: https://gitlist.dev/e/ca09fdf0-43e5-0bc6-1fe1-9331e3820d6a%40avirtualhome.com

```
Using git-gui on systems that run a TK version below 8.6.0 results in a
crash when checking for the current theme.

Catch the error on those systems and use a different command to check
for the current theme.

Signed-off-by: Peter van der Does <peter@avirtualhome.com>
---
 lib/themed.tcl | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/themed.tcl b/lib/themed.tcl
index 351a712..bb4e8f2 100644
--- a/lib/themed.tcl
+++ b/lib/themed.tcl
@@ -248,7 +248,11 @@ proc tspinbox {w args} {
 proc ttext {w args} {
 	global use_ttk
 	if {$use_ttk} {
-		switch -- [ttk::style theme use] {
+		# Handle either current Tk or older versions of 8.5
+		if {[catch {set theme [ttk::style theme use]}]} {
+			set theme  $::ttk::currentTheme
+		}
+		switch -- $theme {
 			"vista" - "xpnative" {
 				lappend args -highlightthickness 0 -borderwidth 0
 			}
-- 
2.12.2

```
