Protect against invalid parents in the IdTreeDB
Summary:
DocumentUrlDB::put is susceptible to invalid parent ids caused by e.g.
renaming while a file/path is added. filePathToId will return 0 for a
(now) invalid dir, although 0 is reserved for the root folder.
As Writetransaction::removeRecursively calls itself for any child document,
having a 0 as child causes infinite recursion.
Test Plan: ctest
Reviewers: Baloo, Frameworks, ngraham, poboiko, astippich
Reviewed By: Baloo, ngraham
Subscribers: kde-frameworks-devel
Tags: Frameworks, Baloo
Differential Revision: https://phabricator.kde.org/D20281