Improved code quality by checking return value before dereferencing it.