Xcode 6.3 (beta) gives me new warnings, any suggestions how to fix the problem? I don't think removing the check completely as void is a correct answer, since in some cases "camera" has been NULL and caused crashing later elsewhere.
Reference cannot be bound to dereferenced null pointer in well-defined C++ code; comparison may be assumed to always evaluate to false
Here's the code. How else could I verify camera exists?
Camera& camera = sceneEngine->camera();
// FIXME: this triggers an undefined-bool-conversion warning in Xcode 6.3 BETA
if (&camera == NULL) return;
And the related method from SceneEngine:
// HEADER
class SceneEngine
{
public:
Camera& camera();
protected:
Camera camera_;
}
// CPP
Camera& SceneEngine::camera() {
return camera_;
}