File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -237,17 +237,23 @@ func Compile(opts Options) *Result {
237
237
wg .Go (func () error {
238
238
// XXX: this is the wrong file name
239
239
source := c .sourcesByIndex [idx ]
240
- c .result .mu .Lock ()
241
- defer c .result .mu .Unlock ()
240
+ ast := c .astsByIndex [idx ]
241
+ if source == nil || ast == nil {
242
+ // Skip attempting to print if there was a problem reading/parsing this file
243
+ // in the first place.
244
+ return nil
245
+ }
242
246
243
- out , err := printer .Print (c . astsByIndex [ idx ] , printer.Options {
247
+ out , err := printer .Print (ast , printer.Options {
244
248
OriginalSource : source ,
245
249
})
246
250
if err != nil {
247
251
c .addError (err )
248
252
return nil
249
253
}
250
254
255
+ c .result .mu .Lock ()
256
+ defer c .result .mu .Unlock ()
251
257
c .result .Files [source .Path ] = out
252
258
return nil
253
259
})
You can’t perform that action at this time.
0 commit comments