CRM-12042 edge case protection
Merge pull request #131 from eileenmcnaughton/CRM-12042

CRM-12042 edge case protection