diff options
| author | Pietro Gagliardi <[email protected]> | 2014-02-15 14:05:10 -0500 |
|---|---|---|
| committer | Pietro Gagliardi <[email protected]> | 2014-02-15 14:05:10 -0500 |
| commit | c67191094f80c7b80de36d91f22bb3e69cb4a6a3 (patch) | |
| tree | a4e2d476cad7d48d5933431066fc1fb739ffd773 | |
| parent | 063293456d929ffab90b8b8c9e609083644b04a1 (diff) | |
Made sure sysData.selectedIndices() returns an empty slice if nothing was selected in a single-selection listbox.
| -rw-r--r-- | sysdata_windows.go | 6 |
1 files changed, 5 insertions, 1 deletions
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) |
