Skip to content

Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.

fix: handle empty xml (#4965)

Bogdan Chadkinb6437fe0dffe
diff --git a/packages/cli/src/prebuild.ts b/packages/cli/src/prebuild.ts
index df4679e1b9..7831edb9b2 100644
--- a/packages/cli/src/prebuild.ts
+++ b/packages/cli/src/prebuild.ts
@@ -497,7 +497,12 @@ export const prebuild = async (options: {
if (documentType === "xml") {
// treat first body child as root
const bodyInstance = instances.get(rootInstanceId);
- if (bodyInstance?.children?.[0].type === "id") {
+ // @todo test empty xml
+ if (
+ bodyInstance &&
+ bodyInstance.children.length > 0 &&
+ bodyInstance.children[0].type === "id"
+ ) {
rootInstanceId = bodyInstance.children[0].value;
}
// remove all unexpected components