Avoid possible NULL dereferences of error_msg

Fixes #155.

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