From 74277cbde08789f0f8422342d9c99557d6c39996 Mon Sep 17 00:00:00 2001 From: Ed Sanders Date: Fri, 13 Dec 2013 00:06:30 +0000 Subject: [PATCH] Check values property exists before removing attribute Apparently the values property is optional so an exception is thrown if it isn't set. Bug: 58421 Change-Id: Ied2a1adb2818fb3f516c1cbde263a675ceb84446 --- modules/ve/dm/ve.dm.Model.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/modules/ve/dm/ve.dm.Model.js b/modules/ve/dm/ve.dm.Model.js index 31b167721c..13a870def8 100644 --- a/modules/ve/dm/ve.dm.Model.js +++ b/modules/ve/dm/ve.dm.Model.js @@ -279,9 +279,11 @@ ve.dm.Model.static.removeHtmlAttribute = function ( dataElement, attribute ) { function removeAttributeRecursive( children ) { var i; for ( i = 0; i < children.length; i++ ) { - delete children[i].values[attribute]; - if ( ve.isEmptyObject( children[i].values ) ) { - delete children[i].values; + if ( children[i].values ) { + delete children[i].values[attribute]; + if ( ve.isEmptyObject( children[i].values ) ) { + delete children[i].values; + } } if ( children[i].children ) { removeAttributeRecursive( children[i].children );