[PATCH] Check url in KDirModelPrivate::nodeForUrl()

David Faure faure at kde.org
Thu Jul 19 18:39:02 BST 2007


On Wednesday 18 July 2007, Aurélien Gâteau wrote:
> Hello,
> 
> If you call KDirModel::itemForUrl(url) with an invalid url, an assert fails
> in KDirModelPrivate::nodeForUrl(). Attached patch fixes this by returning
> an invalid index instead. Is it the correct behavior? Is it ok to commit?

OK, you're not the first one who expects more builtin-checks rather than
contract-based programming, so I don't object to the patch.

I would just like to note that this assert has helped detect some application
bugs in the past... The question one should be asking himself is, why am I
calling this method with an invalid URL (or one that is unrelated to the dirmodel)...

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list