diff --git a/src/Main/CameraGroup.cxx b/src/Main/CameraGroup.cxx index 1c0bb6cca..e80e0c564 100644 --- a/src/Main/CameraGroup.cxx +++ b/src/Main/CameraGroup.cxx @@ -646,15 +646,16 @@ CameraInfo* CameraGroup::buildGUICamera(SGPropertyNode* cameraNode, const SGPropertyNode* windowNode = (cameraNode ? cameraNode->getNode("window") : 0); - if (!window) { - if (windowNode) { - // New style window declaration / definition - window = wBuild->buildWindow(windowNode); - - } else { - return 0; - } + if (!window && windowNode) { + // New style window declaration / definition + window = wBuild->buildWindow(windowNode); } + + if (!window) { // buildWindow can fail + SG_LOG(SG_GENERAL, SG_WARN, "CameraGroup::buildGUICamera: failed to build a window"); + return NULL; + } + Camera* camera = new Camera; camera->setAllowEventFocus(false); camera->setGraphicsContext(window->gc.get()); diff --git a/src/Main/WindowBuilder.cxx b/src/Main/WindowBuilder.cxx index d1c90618f..740671cd5 100644 --- a/src/Main/WindowBuilder.cxx +++ b/src/Main/WindowBuilder.cxx @@ -224,12 +224,14 @@ GraphicsWindow* WindowBuilder::getDefaultWindow() GraphicsContext::Traits* traits = new GraphicsContext::Traits(*defaultTraits); traits->windowName = "FlightGear"; + GraphicsContext* gc = GraphicsContext::createGraphicsContext(traits); if (gc) { defaultWindow = WindowSystemAdapter::getWSA() ->registerWindow(gc, defaultWindowName); return defaultWindow; } else { + SG_LOG(SG_GENERAL, SG_ALERT, "getDefaultWindow: failed to create GraphicsContext"); return 0; } }