#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)
Change History (4)
Changed 14 years ago by
Attachment: | glassdoor ckeditor.zip added |
---|
comment:1 Changed 14 years ago by
Resolution: | → invalid |
---|---|
Status: | new → closed |
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
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.
plugins that I use, which might help if you want to reproduce.