Skip to content

Commit

Permalink
fix bad import syntax edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
alixander committed Feb 5, 2024
1 parent 0214358 commit 6272d3e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ci/release/changelogs/next.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion d2ir/import.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 6272d3e

Please sign in to comment.