Fixes #3938. Do more error checking.
Fixes #3938. Do more error checking.

brunostein/pfsense,phil-davis/pfsense,ch1c4um/pfsense,pfsense/pfsense,ptorsten/pfsense,NewEraCracker/pfsense,NOYB/pfsense,pfsense/pfsense,jxmx/pfsense,pfsense/pfsense,ptorsten/pfsense,NewEraCracker/pfsense,phil-davis/pfsense,NOYB/pfsense,ptorsten/pfsense,NOYB/pfsense,jxmx/pfsense,dennypage/pfsense,dennypage/pfsense,ch1c4um/pfsense,BlackstarGroup/pfsense,BlackstarGroup/pfsense,ch1c4um/pfsense,ch1c4um/pfsense,dennypage/pfsense,brunostein/pfsense,dennypage/pfsense,pfsense/pfsense,BlackstarGroup/pfsense,NewEraCracker/pfsense,phil-davis/pfsense,phil-davis/pfsense,brunostein/pfsense,NewEraCracker/pfsense,jxmx/pfsense,BlackstarGroup/pfsense