From 9c880bb738af75178f6dbacc570dfa772f84fa70 Mon Sep 17 00:00:00 2001 From: Volker Schukai <volker.schukai@schukai.com> Date: Mon, 17 Oct 2022 18:04:09 +0200 Subject: [PATCH] fix panic is format is nil --- file.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/file.go b/file.go index 29b1c47..f3161de 100644 --- a/file.go +++ b/file.go @@ -37,9 +37,10 @@ func (s *Settings[c]) HasFile(file string) bool { func (s *Settings[C]) AddFile(file string, format ...Format) *Settings[C] { var f Format - f = RecogniseFormat - if len(format) <= 1 { + if format == nil || len(format) == 0 { + f = RecogniseFormat + } else if format != nil && len(format) == 1 { f = format[0] } else { panic("too many arguments") -- GitLab