fix: nil labelPosition

This commit is contained in:
donglixiaoche 2023-03-27 21:40:36 +08:00
parent d33efa28f2
commit 54250d00dd
No known key found for this signature in database
GPG key ID: 3190E65EBAD6D6E2

View file

@ -109,7 +109,7 @@ func place(obj *d2graph.Object) (float64, float64) {
break
}
if !strings.Contains(*obj.LabelPosition, "INSIDE") && obj.LabelPosition != nil {
if obj.LabelPosition != nil && !strings.Contains(*obj.LabelPosition, "INSIDE") {
if strings.Contains(*obj.LabelPosition, "_TOP_") {
// label is on the top, and container is placed on the bottom
if strings.Contains(nearKeyStr, "bottom") {