coverity: fixed unchecked return value from library
coverity: Dereference after null check