From c67191094f80c7b80de36d91f22bb3e69cb4a6a3 Mon Sep 17 00:00:00 2001 From: Pietro Gagliardi Date: Sat, 15 Feb 2014 14:05:10 -0500 Subject: [PATCH] Made sure sysData.selectedIndices() returns an empty slice if nothing was selected in a single-selection listbox. --- sysdata_windows.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sysdata_windows.go b/sysdata_windows.go index 7458f45..42c8f94 100644 --- a/sysdata_windows.go +++ b/sysdata_windows.go @@ -363,7 +363,11 @@ func (s *sysData) selectedIndex() int { func (s *sysData) selectedIndices() []int { if !s.alternate { // single-selection list box; use single-selection method - return []int{s.selectedIndex()} + index := s.selectedIndex() + if index == -1 { + return nil + } + return []int{index} } ret := make(chan uiret)