[KPhotoAlbum] Keywords with id=0?

Johannes Zarl-Zierl johannes at zarl-zierl.at
Sun Dec 15 23:30:54 GMT 2019


Am Sonntag, 15. Dezember 2019, 22:59:40 CET schrieb Robert Krawitz:
> On Sun, 15 Dec 2019 19:05:27 +0100, Johannes Zarl-Zierl wrote:
> >> > A final thought (not having tried the fix yet): shouldn't we also use
> >> > m_idMap.at(name, 0) instead of m_idMap[name] in idForName()?
> >> 
> >> Why?
> > 
> > Because in initIdMap() we check whether the m_idMap already contains
> > the tag and only set an id otherwise. We don't want to insert an
> > invalid value into m_idMap by using operator[].
> 
> We're not inserting anything in idForName(); we're just retrieving it.

Sorry, I somehow overlooked that idForName() is of course const. I'm somewhat 
paranoid when it comes to QMap::operator[] ever since I've accidentally 
inserted values into a map by calling its non-const version.





More information about the Kphotoalbum mailing list