From fa6e03a7d408451ae62517867dcea80cf7672c77 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nwpope@utu.fi>
Date: Thu, 4 Jul 2019 17:24:28 +0300
Subject: [PATCH] Fix for segv on gui start

---
 applications/gui/src/screen.cpp                   | 2 +-
 components/rgbd-sources/src/middlebury_source.cpp | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/applications/gui/src/screen.cpp b/applications/gui/src/screen.cpp
index e451e4819..d6244156f 100644
--- a/applications/gui/src/screen.cpp
+++ b/applications/gui/src/screen.cpp
@@ -337,7 +337,7 @@ void ftl::gui::Screen::draw(NVGcontext *ctx) {
 
 		mImageID = camera_->captureFrame().texture();
 
-		if (imageSize[0] > 0) {
+		if (mImageID < std::numeric_limits<unsigned int>::max() && imageSize[0] > 0) {
 			auto mScale = (screenSize.cwiseQuotient(imageSize).minCoeff());
 			Vector2f scaleFactor = mScale * imageSize.cwiseQuotient(screenSize);
 			Vector2f positionInScreen(0.0f, 0.0f);
diff --git a/components/rgbd-sources/src/middlebury_source.cpp b/components/rgbd-sources/src/middlebury_source.cpp
index 463491439..296d7b6e8 100644
--- a/components/rgbd-sources/src/middlebury_source.cpp
+++ b/components/rgbd-sources/src/middlebury_source.cpp
@@ -194,7 +194,7 @@ void MiddleburySource::_performDisparity() {
 }
 
 bool MiddleburySource::grab(int n, int b) {
-	_performDisparity();
+	//_performDisparity();
 	return true;
 }
 
-- 
GitLab