Fix several small errors as determined by the Coverity scan.

One potential NULL dereference, but mostly checks for return values
from SMARTS calls.