diff --git a/d2ir/compile.go b/d2ir/compile.go index 03cc04b85..e59cb51be 100644 --- a/d2ir/compile.go +++ b/d2ir/compile.go @@ -66,6 +66,9 @@ func (c *compiler) compileSteps(m *Map) { if i == 0 { base = m.CopyBase(sf) } else { + if steps.Fields[i-1].Map() == nil { + continue + } base = steps.Fields[i-1].Map().CopyBase(sf) } OverlayMap(base, sf.Map()) diff --git a/e2etests/testdata/todo/steps_panic/dagre/board.exp.json b/e2etests/testdata/todo/steps_panic/dagre/board.exp.json new file mode 100644 index 000000000..b230f4a99 --- /dev/null +++ b/e2etests/testdata/todo/steps_panic/dagre/board.exp.json @@ -0,0 +1,22 @@ +{ + "name": "", + "fontFamily": "SourceSansPro", + "shapes": [], + "connections": [], + "scenarios": [ + { + "name": "hey", + "fontFamily": "SourceSansPro", + "shapes": [], + "connections": [] + } + ], + "steps": [ + { + "name": "id", + "fontFamily": "SourceSansPro", + "shapes": [], + "connections": [] + } + ] +} diff --git a/e2etests/testdata/todo/steps_panic/dagre/sketch.exp.svg b/e2etests/testdata/todo/steps_panic/dagre/sketch.exp.svg new file mode 100644 index 000000000..5169c50f1 --- /dev/null +++ b/e2etests/testdata/todo/steps_panic/dagre/sketch.exp.svg @@ -0,0 +1,45 @@ + + + + + \ No newline at end of file diff --git a/e2etests/testdata/todo/steps_panic/elk/board.exp.json b/e2etests/testdata/todo/steps_panic/elk/board.exp.json new file mode 100644 index 000000000..b230f4a99 --- /dev/null +++ b/e2etests/testdata/todo/steps_panic/elk/board.exp.json @@ -0,0 +1,22 @@ +{ + "name": "", + "fontFamily": "SourceSansPro", + "shapes": [], + "connections": [], + "scenarios": [ + { + "name": "hey", + "fontFamily": "SourceSansPro", + "shapes": [], + "connections": [] + } + ], + "steps": [ + { + "name": "id", + "fontFamily": "SourceSansPro", + "shapes": [], + "connections": [] + } + ] +} diff --git a/e2etests/testdata/todo/steps_panic/elk/sketch.exp.svg b/e2etests/testdata/todo/steps_panic/elk/sketch.exp.svg new file mode 100644 index 000000000..5169c50f1 --- /dev/null +++ b/e2etests/testdata/todo/steps_panic/elk/sketch.exp.svg @@ -0,0 +1,45 @@ + + + + + \ No newline at end of file diff --git a/e2etests/todo_test.go b/e2etests/todo_test.go index 907cd750a..bd2aeded0 100644 --- a/e2etests/todo_test.go +++ b/e2etests/todo_test.go @@ -162,11 +162,14 @@ small code: |go `, }, { - skip: true, name: "steps_panic", script: `steps: { shape: sql_table - id: {type: int, constraint: primary_key} + id: int {constraint: primary_key} +} +scenarios: { + shape: sql_table + hey: int {constraint: primary_key} } `, },