fixed the problem as described in the bug report by
adding a check for None before the error gets a chance
to be triggered.
Patch for bug #1356639
Logged In: YES
Aplied to the revision 1450 to the trunk and backported to
the 0.7-branch. Thank you!