0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2025-01-03 13:16:31 -05:00

Check for null return from Range#getStartBlock.

This commit is contained in:
Neil Jenkins 2013-04-05 15:58:34 +11:00
parent 02d25f0ef5
commit 10abc3faf8

View file

@ -1658,7 +1658,7 @@
getRangeAndRemoveBookmark( range ); getRangeAndRemoveBookmark( range );
event.preventDefault(); event.preventDefault();
var current = range.getStartBlock(), var current = range.getStartBlock(),
previous = current.getPreviousBlock(); previous = current && current.getPreviousBlock();
// Must not be at the very beginning of the text area. // Must not be at the very beginning of the text area.
if ( previous ) { if ( previous ) {
// If not editable, just delete whole block. // If not editable, just delete whole block.
@ -1723,7 +1723,7 @@
getRangeAndRemoveBookmark( range ); getRangeAndRemoveBookmark( range );
event.preventDefault(); event.preventDefault();
var current = range.getStartBlock(), var current = range.getStartBlock(),
next = current.getNextBlock(); next = current && current.getNextBlock();
// Must not be at the very end of the text area. // Must not be at the very end of the text area.
if ( next ) { if ( next ) {
// If not editable, just delete whole block. // If not editable, just delete whole block.