Skip to content

Commit 9c2f3a2

Browse files
mauri870gopherbot
authored andcommitted
cmd/gotext: fix segfault in extract & rewrite commands
If extract or rewrite are called with no arguments it results in a segmentation fault, since we dereference the out flag that was not defined for these commands. Fixes golang/go#62697 Change-Id: I697943b7c221431d0361bcec74c18183f6e141ea GitHub-Last-Rev: 313ddfa GitHub-Pull-Request: #46 Reviewed-on: https://go-review.googlesource.com/c/text/+/529255 Reviewed-by: Marcel van Lohuizen <[email protected]> Auto-Submit: Ian Lance Taylor <[email protected]> Reviewed-by: Ian Lance Taylor <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 59e1219 commit 9c2f3a2

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

cmd/gotext/main.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,18 @@ func config() (*pipeline.Config, error) {
4848
if err != nil {
4949
return nil, wrap(err, "invalid srclang")
5050
}
51+
52+
// Use a default value since rewrite and extract don't have an out flag.
53+
genFile := ""
54+
if out != nil {
55+
genFile = *out
56+
}
57+
5158
return &pipeline.Config{
5259
SourceLanguage: tag,
5360
Supported: getLangs(),
5461
TranslationsPattern: `messages\.(.*)\.json$`,
55-
GenFile: *out,
62+
GenFile: genFile,
5663
Dir: *dir,
5764
}, nil
5865
}

0 commit comments

Comments
 (0)