safeguards

In my keepass file, the groups don't have subgroups,
and some of them have no entries
Merge pull request #1 from yanick/master

protection from deref'ing undefs