Backport crash fix from proko2.
Backport crash fix from proko2.

svn path=/branches/KDE/3.5/kdepim/; revision=526818

lefou/kdepim-noakonadi,lefou/kdepim-noakonadi,lefou/kdepim-noakonadi,lefou/kdepim-noakonadi,lefou/kdepim-noakonadi,lefou/kdepim-noakonadi