Fixing bugs from Coverity related to Dereferenced Null after check and as return value.

Signed-off-by: Daan Hoogland <daan@onecht.net>