Avoid possible NULL dereferences of error_msg

Fixes #155.

Signed-off-by: Martin Milata <mmilata@redhat.com>