Opened 13 years ago

Closed 13 years ago

Last modified 13 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@…


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.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.addRange( nativeRange );

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

Attachments (1)

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

Download all attachments as: .zip

Change History (4)

Changed 13 years ago by Ron Lussier

Attachment: glassdoor added

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

comment:1 Changed 13 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 13 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 13 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