Index: _source/plugins/selection/plugin.js
===================================================================
--- _source/plugins/selection/plugin.js	(revision 3350)
+++ _source/plugins/selection/plugin.js	(working copy)
@@ -259,7 +259,8 @@
 	 */
 	CKEDITOR.dom.document.prototype.getSelection = function()
 	{
-		return new CKEDITOR.dom.selection( this );
+		var sel = new CKEDITOR.dom.selection( this );
+		return ( !sel || sel.isInvalid ) ? null : sel;
 	};
 
 	/**
@@ -319,11 +320,9 @@
 				|| ( range.item && range.item(0).ownerDocument != this.document.$ )
 				|| ( range.parentElement && range.parentElement().ownerDocument != this.document.$ ) )
 			{
-				return null;
+				this.isInvalid = true;
 			}
 		}
-		
-		return this;
 	};
 
 	var styleObjectElements =
