diff --git a/src/renderer/renderer.ts b/src/renderer/renderer.ts
index ca8ac956..95178f93 100644
--- a/src/renderer/renderer.ts
+++ b/src/renderer/renderer.ts
@@ -991,7 +991,8 @@ export class SDFGRenderer extends EventEmitter {
this.sdfg_tree = {};
this.for_all_sdfg_elements(
(otype: SDFGElementGroup, odict: any, obj: any) => {
- if (obj.type === SDFGElementType.NestedSDFG)
+ if (obj.type === SDFGElementType.NestedSDFG &&
+ obj.attributes.sdfg)
this.sdfg_tree[obj.attributes.sdfg.sdfg_list_id] =
odict.sdfg.sdfg_list_id;
}
@@ -1907,7 +1908,8 @@ export class SDFGRenderer extends EventEmitter {
// If nested SDFG, traverse recursively
if (node.data.node.type ===
- SDFGElementType.NestedSDFG)
+ SDFGElementType.NestedSDFG &&
+ node.attributes().sdfg)
traverseRecursive(
node.data.graph,
node.attributes().sdfg.attributes.name,
@@ -2004,7 +2006,8 @@ export class SDFGRenderer extends EventEmitter {
);
// If nested SDFG, traverse recursively
- if (node.type === SDFGElementType.NestedSDFG)
+ if (node.type === SDFGElementType.NestedSDFG &&
+ node.attributes.sdfg)
traverse_recursive(node.attributes.sdfg);
});
@@ -3739,7 +3742,7 @@ function relayoutSDFGState(
const topleft = gnode.topleft();
// Offset nested SDFG.
- if (node.type === SDFGElementType.NestedSDFG) {
+ if (node.type === SDFGElementType.NestedSDFG && node.attributes.sdfg) {
offset_sdfg(node.attributes.sdfg, gnode.data.graph, {
x: topleft.x + SDFV.LINEHEIGHT,
diff --git a/src/renderer/renderer_elements.ts b/src/renderer/renderer_elements.ts
index 44adbb7c..be2383fe 100644
--- a/src/renderer/renderer_elements.ts
+++ b/src/renderer/renderer_elements.ts
@@ -2087,7 +2087,9 @@ export class NestedSDFG extends SDFGNode {
ctx.fillStyle = this.getCssProperty(
renderer, '--node-foreground-color'
);
- const label = this.data.node.attributes.label;
+ let label = this.data.node.attributes.label;
+ if (!this.data.node.attributes.sdfg)
+ label += ' (not loaded)';
const textmetrics = ctx.measureText(label);
ctx.fillText(
label, this.x - textmetrics.width / 2.0,
@@ -2514,7 +2516,8 @@ export function offset_state(
c.y += offset.y;
});
- if (node.data.node.type === SDFGElementType.NestedSDFG)
+ if (node.data.node.type === SDFGElementType.NestedSDFG &&
+ node.data.node.attributes.sdfg)
offset_sdfg(
node.data.node.attributes.sdfg, node.data.graph, offset
);
diff --git a/src/sdfv.ts b/src/sdfv.ts
index bac3f2fe..a46099df 100644
--- a/src/sdfv.ts
+++ b/src/sdfv.ts
@@ -326,7 +326,7 @@ export class SDFV {
}
// If nested SDFG, add SDFG information too
- if (elem instanceof NestedSDFG) {
+ if (elem instanceof NestedSDFG && elem.attributes().sdfg) {
const sdfg_sdfg = elem.attributes().sdfg;
contents.append($('
'));
contents.append($('