Exception thrown in KHTMLPart::selection()

Jason Keirstead jason at keirstead.org
Wed Jan 19 15:42:22 GMT 2005


On Wednesday 19 January 2005 10:22 am, John Tapsell wrote:
> I don't know.  It doesn't crash when I try lots of things.  just crashes
> occasionally.  Is there a way to at least check if this is going to fail?
> I'd rather do nothing then have it crash at least:
>
>  } else if(!n->renderer()->isReplaced() && !n->renderer()->isBR()) {
>         r.setEnd( d->m_selectionEnd, d->m_endOffset );
>
> That causes the exception INDEX_SIZE_ERR

According to the code in kdelibs/khtml/xml/dom2_rangeimpl.cpp, method 
checkNodeWOffset, on a DOM::Range node, this would only be thrown if the 
m_endOffset was < 0.

So, just check for this condition before calling setEnd.

Or find out where it is being set to -1 and correct it. Should be simple to do 
with some kdDebug() statements.

-- 
If you wait by the river long enough, eventually
you will see the bodies of all your enemies float by.
    - Sun Tzu




More information about the kfm-devel mailing list