Skip to content

Commit fed3449

Browse files
committed
fix: handle potential null properties in SuperConverter
- Updated the SuperConverter class to safely access the 'Properties' element in custom XML, ensuring that the code handles cases where the element may not exist. - This change improves the robustness of the document conversion process by preventing potential runtime errors.
1 parent 0803d04 commit fed3449

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

packages/super-editor/src/core/super-converter/SuperConverter.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,8 @@ class SuperConverter {
218218
if (!docx[customLocation]) docx[customLocation] = generateCustomXml();
219219

220220
const customXml = docx[customLocation];
221-
const properties = customXml.elements.find((el) => el.name === 'Properties');
221+
const properties = customXml.elements?.find((el) => el.name === 'Properties');
222+
if (!properties) return null;
222223
if (!properties.elements) properties.elements = [];
223224

224225
// Check if property already exists

0 commit comments

Comments
 (0)