diff --git a/ci/release/changelogs/next.md b/ci/release/changelogs/next.md index f3c0d2a774..2d39449f07 100644 --- a/ci/release/changelogs/next.md +++ b/ci/release/changelogs/next.md @@ -3,3 +3,5 @@ #### Improvements 🧹 #### Bugfixes ⛑️ + +- Fixes edge case of bad import syntax crashing using d2 as a library [1829](https://github.com/terrastruct/d2/pull/1829) diff --git a/d2ir/import.go b/d2ir/import.go index c8ef907608..b933298dd2 100644 --- a/d2ir/import.go +++ b/d2ir/import.go @@ -12,7 +12,7 @@ import ( func (c *compiler) pushImportStack(imp *d2ast.Import) (string, bool) { impPath := imp.PathWithPre() - if impPath == "" && imp.Range.Path != "" { + if impPath == "" && imp.Range != (d2ast.Range{}) { c.errorf(imp, "imports must specify a path to import") return "", false }