Index: trunk/extensions/UsabilityInitiative/js/plugins/jquery.wikiEditor.templateEditor.js |
— | — | @@ -319,8 +319,10 @@ |
320 | 320 | var sanatizedStr = wikitext.replace( /{{/, " " ); |
321 | 321 | // Replace end |
322 | 322 | endBraces = sanatizedStr.match( /}}\s*$/ ); |
323 | | - sanatizedStr = sanatizedStr.substring( 0, endBraces.index ) + " " + |
324 | | - sanatizedStr.substring( endBraces.index + 2 ); |
| 323 | + if ( endBraces ) { |
| 324 | + sanatizedStr = sanatizedStr.substring( 0, endBraces.index ) + " " + |
| 325 | + sanatizedStr.substring( endBraces.index + 2 ); |
| 326 | + } |
325 | 327 | // Match the open braces we just found with equivalent closing braces note, works for any level of braces |
326 | 328 | while ( sanatizedStr.indexOf( '{{' ) != -1 ) { |
327 | 329 | startIndex = sanatizedStr.indexOf( '{{' ) + 1; |