Index: /CKEditor/trunk/_source/plugins/styles/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/styles/plugin.js	(revision 3394)
+++ /CKEditor/trunk/_source/plugins/styles/plugin.js	(revision 3395)
@@ -317,5 +317,11 @@
 		var firstNode = boundaryNodes.startNode;
 		var lastNode = boundaryNodes.endNode.getNextSourceNode( true );
-
+		
+		// Probably the document end is reached, we need a marker node.  
+		if ( !lastNode )
+		{
+				lastNode = document.createText( '' );
+				lastNode.insertAfter( range.endContainer );
+		}
 		// The detection algorithm below skips the contents inside bookmark nodes, so
 		// we'll need to make sure lastNode isn't the &nbsp; inside a bookmark node.
