Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#6752 closed Bug (invalid)

Null pointer exception in selection/plugin.js

Reported by: Ron Lussier Owned by:
Priority: Normal Milestone:
Component: General Version: 3.4.2
Keywords: Cc: rlussier@…

Description

This happens for me, probably as a result of one or more custom plugins or skins I've written. The fix seems fairly easy, however, so I'm hoping that I can get you to incorporate it.

The following code is at the end of the selection plugin:

var selection = this.document.getSelection().getNative();
selection.removeAllRanges();
selection.addRange( nativeRange );

I'm seeing an error because 'selection' is null when the CKEditor is initialized. Adding a check as follows fixes the problem:

var selection = this.document.getSelection().getNative();
if (selection) {
   selection.removeAllRanges();
   selection.addRange( nativeRange );
}

I've attached my skin and custom plugins, just in case it helps you to confirm this.

Attachments (1)

glassdoor ckeditor.zip (84.5 KB) - added by Ron Lussier 14 years ago.
plugins that I use, which might help if you want to reproduce.

Download all attachments as: .zip

Change History (4)

Changed 14 years ago by Ron Lussier

Attachment: glassdoor ckeditor.zip added

plugins that I use, which might help if you want to reproduce.

comment:1 Changed 14 years ago by Garry Yao

Resolution: invalid
Status: newclosed

Thanks for the report, since we don't recommend interaction with the native selection directly but through CKEDITOR.dom.selection, so the case here is subjected to be checked by plugin developers.

comment:2 Changed 14 years ago by Ron Lussier

Cc: rlussier@… added

You misunderstand the issue. My plugin is not interacting with the native selection at all. I traced through the CKEditor source code and found that call to "this.document.getSelection().getNative();" is returning a null value, which the next line of YOUR code then attempts to use without checking it.

Please don't dismiss this bug so cavalierly. It discourages users from bothering to file bugs.

comment:3 Changed 14 years ago by Wiktor Walc

Duplicate of #6577.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy