Skip to content

Commit fc2a1e2

Browse files
committed
Ensure map exists allowing to bypass constructor
1 parent 4e641a9 commit fc2a1e2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

files.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ func (f *FilePool) Add(fileName string, e encoding.Encoder) {
5656
if _, ok := f.m[output]; ok {
5757
Panicf("filename clash: %s", output)
5858
}
59+
60+
if f.m == nil {
61+
f.m = make(map[string]string)
62+
}
5963
f.m[output] = string(b)
6064
}
6165

0 commit comments

Comments
 (0)