Skip to content

Commit defdde0

Browse files
authored
Merge pull request #1829 from alixander/fix-bad-import
fix bad import syntax edge case
2 parents 0214358 + 6272d3e commit defdde0

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

ci/release/changelogs/next.md

+2
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,5 @@
33
#### Improvements 🧹
44

55
#### Bugfixes ⛑️
6+
7+
- Fixes edge case of bad import syntax crashing using d2 as a library [1829](https://github.com/terrastruct/d2/pull/1829)

d2ir/import.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import (
1212

1313
func (c *compiler) pushImportStack(imp *d2ast.Import) (string, bool) {
1414
impPath := imp.PathWithPre()
15-
if impPath == "" && imp.Range.Path != "" {
15+
if impPath == "" && imp.Range != (d2ast.Range{}) {
1616
c.errorf(imp, "imports must specify a path to import")
1717
return "", false
1818
}

0 commit comments

Comments
 (0)