Index: /CKEditor/branches/prototype/_source/plugins/link/dialogs/link.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/link/dialogs/link.js	(revision 2870)
+++ /CKEditor/branches/prototype/_source/plugins/link/dialogs/link.js	(revision 2871)
@@ -635,5 +635,18 @@
 
 			// Find out whether we have any anchors in the editor.
-			var anchors = editor.document.$.anchors;
+
+			// Get all IMG elements in CK document.
+			var elements = editor.document.$.getElementsByTagName( 'img' );
+			var anchors = new Array();
+			for( var i = 0; i < elements.length; i++ )
+			{
+				element = elements.item( i );
+				if ( element.getAttribute( '_cke_protected_html' ) && element.getAttribute( '_cke_real_element_type' ) == "anchor" )
+				{
+					var domElement = new CKEDITOR.dom.element( element );
+					domElement = CKEDITOR.plugins.fakeobjects.restoreElement( domElement );
+					anchors.push( domElement );
+				}
+			}
 			if ( anchors.length < 1 )
 			{
