Skip to content

Commit b116b99

Browse files
ben-claytonDawn LUCI CQ
authored andcommitted
[tools][gen] Fix nil-deref on non-existent include
File() used to get-or-create. Now you need to call AddFile() first. Change-Id: I5166258abe80f192bfec48e823d94459668af01b Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/146900 Commit-Queue: Antonio Maiorano <[email protected]> Auto-Submit: Ben Clayton <[email protected]> Reviewed-by: Antonio Maiorano <[email protected]> Kokoro: Kokoro <[email protected]>
1 parent d085612 commit b116b99

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tools/src/cmd/gen/build/build.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,10 +233,10 @@ func scanSourceFiles(p *Project) error {
233233
if strings.HasPrefix(include.path, srcTint) {
234234
// #include "src/tint/..."
235235
include.path = include.path[len(srcTint)+1:] // Strip 'src/tint/'
236-
includeFile := p.File(include.path)
237236

238-
if _, err := os.Stat(includeFile.AbsPath()); err != nil {
239-
return fmt.Errorf(`%v:%v includes non-existent file '%v'`, file.Path(), include.line, includeFile.AbsPath())
237+
includeFile := p.File(include.path)
238+
if includeFile == nil {
239+
return fmt.Errorf(`%v:%v includes non-existent file '%v'`, file.Path(), include.line, include.path)
240240
}
241241

242242
dependencyKind := targetKindFromFilename(include.path)

0 commit comments

Comments
 (0)