diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b795f04..68c927c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ ## Changelog +### 12.77.1 + +* `[options]` Fixed bug with `Split` result for empty options + ### 12.77.0 * `[options]` Added merge symbol customization diff --git a/ek.go b/ek.go index 15bf17b0..072f8200 100644 --- a/ek.go +++ b/ek.go @@ -20,7 +20,7 @@ import ( // ////////////////////////////////////////////////////////////////////////////////// // // VERSION is current ek package version -const VERSION = "12.77.0" +const VERSION = "12.77.1" // ////////////////////////////////////////////////////////////////////////////////// // diff --git a/options/options.go b/options/options.go index 054c1790..5726acee 100644 --- a/options/options.go +++ b/options/options.go @@ -299,7 +299,13 @@ func (opts *Options) GetF(name string) float64 { // Split splits mergeble option to it's values func (opts *Options) Split(name string) []string { - return strings.Split(opts.GetS(name), MergeSymbol) + value := opts.GetS(name) + + if value == "" { + return nil + } + + return strings.Split(value, MergeSymbol) } // Is checks if option with given name has given value diff --git a/options/options_test.go b/options/options_test.go index 86ea299f..69b9480b 100644 --- a/options/options_test.go +++ b/options/options_test.go @@ -112,6 +112,7 @@ func (s *OptUtilSuite) TestGlobal(c *C) { c.Assert(Is("s:string", "Test"), Equals, true) c.Assert(Is("string1", "Test"), Equals, false) c.Assert(Split("s:string"), DeepEquals, []string{"Test"}) + c.Assert(Split("s:string1"), IsNil) } func (s *OptUtilSuite) TestLimiters(c *C) {