From f94d626fb6db581c75dfd83713da59e0fdfd33d8 Mon Sep 17 00:00:00 2001
From: aacuevas <aacuelo@teleco.upv.es>
Date: Mon, 11 Nov 2013 15:31:47 +0100
Subject: [PATCH] Avoid crash if board not present but rescan ports button
 pressed

---
 Source/Processors/DataThreads/RHD2000Thread.cpp | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Source/Processors/DataThreads/RHD2000Thread.cpp b/Source/Processors/DataThreads/RHD2000Thread.cpp
index b9180ab3e..ed9ef71d4 100644
--- a/Source/Processors/DataThreads/RHD2000Thread.cpp
+++ b/Source/Processors/DataThreads/RHD2000Thread.cpp
@@ -293,6 +293,10 @@ void RHD2000Thread::initializeBoard()
 
 void RHD2000Thread::scanPorts()
 {
+	if (!deviceFound) //Safety to avoid crashes if board not present
+	{
+		return;
+	}
     // Scan SPI ports
 
     int delay, stream, id;
-- 
GitLab