Skip to content

Error with connection to grid cell container #1719

@mrsaiz

Description

@mrsaiz

Hello,

I am using the D2 version 0.6.1 and I am getting an error when compiling the next diagram locally:

grid-rows: 1
grid-columns: 2

box1: {
}

box2: {
  explanation: |md
    hello world!
  |
}
box1 -> box2
> d2 -l tala issue.d2 issue.svg
panic: runtime error: index out of range [1] with length 0

goroutine 67 [running]:
oss.terrastruct.com/d2/d2renderers/d2svg.getArrowheadAdjustments({{0x14000436240, 0x11}, {0x0, 0x0, 0x0}, {0x1400053a470, 0x4}, {0x104ed7bc2, 0x4}, 0x0, ...}, ...)
	oss.terrastruct.com/d2/d2renderers/d2svg/d2svg.go:366 +0x120
oss.terrastruct.com/d2/d2renderers/d2svg.drawConnection({_, _}, {_, _}, {{0x14000436240, 0x11}, {0x0, 0x0, 0x0}, {0x1400053a470, ...}, ...}, ...)
	oss.terrastruct.com/d2/d2renderers/d2svg/d2svg.go:524 +0x5f0
oss.terrastruct.com/d2/d2renderers/d2svg.Render(0x14000768000, 0x14000814028)
	oss.terrastruct.com/d2/d2renderers/d2svg/d2svg.go:1788 +0x868
oss.terrastruct.com/d2/d2cli._render({0x105dca580, 0x14000554000}, 0x14000617140?, {0x105dcb868, 0x14000470180}, {0x1400053a630, 0x1400053a628, 0x1400053a638, 0x1065bd6e0, 0x0, ...}, ...)
	oss.terrastruct.com/d2/d2cli/main.go:733 +0x25c
oss.terrastruct.com/d2/d2cli.render({0x105dca580, 0x14000554000}, 0x140003f2f50, 0xccd2dd8, {0x105dcb868, 0x14000470180}, {0x1400053a630, 0x1400053a628, 0x1400053a638, 0x1065bd6e0, ...}, ...)
	oss.terrastruct.com/d2/d2cli/main.go:711 +0x744
oss.terrastruct.com/d2/d2cli.compile({0x105dca580?, 0x14000554000}, 0x140003f2f50, {0x140003ca6c0, 0x3, 0x4}, 0x140005a4060, {0x1400053a630, 0x1400053a628, 0x1400053a638, ...}, ...)
	oss.terrastruct.com/d2/d2cli/main.go:508 +0x1204
oss.terrastruct.com/d2/d2cli.Run({0x105dca510?, 0x140005103c0?}, 0x140003f2f50)
	oss.terrastruct.com/d2/d2cli/main.go:334 +0x1e74
oss.terrastruct.com/util-go/xmain.(*State).Main.func1()
	oss.terrastruct.com/[email protected]/xmain/xmain.go:105 +0x64
created by oss.terrastruct.com/util-go/xmain.(*State).Main in goroutine 1
	oss.terrastruct.com/[email protected]/xmain/xmain.go:103 +0x104

If I remove the connection or the markdown, it works.

grid-rows: 1
grid-columns: 2

box1: {
}

box2: {
  explanation: |md
    hello world!
  |
} 
# this works!
grid-rows: 1
grid-columns: 2

box1: {
}

box2: {
}
box1 -> box2
# this works!

However, when using the D2 Studio Playground, this issue is not happening and everything is working as expected...

image

https://play.d2lang.com/?script=gvvOSsGQC9n7VgpGXFxJ-RWGYNLISqGaS0EhtaIgJzEvERTIVgo1uSlcCgoKChmpOTn5CuX5RTkpilwKCjVctWB9Crp2CiCdXIAAAAD__w%3D%3D&layout=tala&

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions