From 474aa3470abb9a9bbbae137574542a6e5ac190a0 Mon Sep 17 00:00:00 2001 From: Sergiusz Bazanski Date: Wed, 1 Aug 2018 04:42:41 +0100 Subject: gui: fix crash on ecp5 gui, fix quadtree tests to not get broken by clangformat --- gui/treemodel.h | 6 ++++++ tests/gui/quadtree.cc | 1 + 2 files changed, 7 insertions(+) diff --git a/gui/treemodel.h b/gui/treemodel.h index 3157dbab..4c3f64c3 100644 --- a/gui/treemodel.h +++ b/gui/treemodel.h @@ -363,10 +363,16 @@ class Model : public QAbstractItemModel { switch (type) { case ElementType::BEL: + if (bel_root_ == nullptr) + return boost::none; return bel_root_->getById(id); case ElementType::WIRE: + if (wire_root_ == nullptr) + return boost::none; return wire_root_->getById(id); case ElementType::PIP: + if (pip_root_ == nullptr) + return boost::none; return pip_root_->getById(id); case ElementType::CELL: return cell_root_->getById(id); diff --git a/tests/gui/quadtree.cc b/tests/gui/quadtree.cc index 89f8e4a3..6711e906 100644 --- a/tests/gui/quadtree.cc +++ b/tests/gui/quadtree.cc @@ -19,6 +19,7 @@ #include "gtest/gtest.h" #include "nextpnr.h" + #include "quadtree.h" USING_NEXTPNR_NAMESPACE -- cgit v1.2.3