From d4b3c2c4ce6a175a07a67a5491485efb93281257 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Tue, 12 Jan 2021 15:56:28 +0100 Subject: Fixed invalid handling of menu offsets --- config/menu.go | 4 ++-- config/menu_test.go | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) (limited to 'config') diff --git a/config/menu.go b/config/menu.go index a442036..f405ec5 100644 --- a/config/menu.go +++ b/config/menu.go @@ -39,11 +39,11 @@ func (m *Menu) validate(name string) error { } // Banner is just any string, nothing to validate // XOffset - if m.XOffset <= 0 { + if m.XOffset < 0 { return errors.New("XOffset must be a positive integer") } // YOffset - if m.YOffset <= 0 { + if m.YOffset < 0 { return errors.New("YOffset must be a positive integer") } // MenuEntries diff --git a/config/menu_test.go b/config/menu_test.go index d0b1805..095b699 100644 --- a/config/menu_test.go +++ b/config/menu_test.go @@ -18,10 +18,7 @@ func TestMenuValidate(t *testing.T) { t.Fatal("Negative XOffset should not be valid") } // YOffset - menu = Menu{ - XOffset: 1, - YOffset: -1, - } + menu = Menu{YOffset: -1} if err := menu.validate("test"); err == nil { t.Fatal("Negative YOffset should not be valid") } -- cgit v1.2.3