diff options
author | Alex Nebotov <46927280+skillful-alex@users.noreply.github.com> | 2020-09-29 02:41:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-09-29 02:41:41 +0300 |
commit | e15e8dff0f800d8323406e3b465866f95ac98bbd (patch) | |
tree | a80b39d1cdeb2a1d4316c3b9faa43fe6e9ee6969 | |
parent | 8f09be85f761f8869081b9b7c7887b46e3b5da21 (diff) |
fixed panic: runtime error: index out of range [0] with length 0 (#212)
-rw-r--r-- | v2/goi18n/extract_command.go | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/v2/goi18n/extract_command.go b/v2/goi18n/extract_command.go index cee9be7..528d617 100644 --- a/v2/goi18n/extract_command.go +++ b/v2/goi18n/extract_command.go @@ -264,6 +264,9 @@ func extractStringLiteral(expr ast.Expr) (string, bool) { } switch z := v.Obj.Decl.(type) { case *ast.ValueSpec: + if len(z.Values) == 0 { + return "", false + } s, ok := extractStringLiteral(z.Values[0]) if !ok { return "", false |