From 34197e361bd6a9614ce2b29a47d309ab6a29d3c9 Mon Sep 17 00:00:00 2001
From: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Date: Wed, 17 Jun 2009 17:31:52 +0200
Subject: [PATCH] make the bounds check in BreakpointHandler::at() an assert

---
 src/plugins/debugger/breakhandler.cpp | 2 --
 src/plugins/debugger/breakhandler.h   | 4 +++-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/plugins/debugger/breakhandler.cpp b/src/plugins/debugger/breakhandler.cpp
index 6542f1db857..10493f47e4a 100644
--- a/src/plugins/debugger/breakhandler.cpp
+++ b/src/plugins/debugger/breakhandler.cpp
@@ -31,8 +31,6 @@
 
 #include "imports.h" // TextEditor::BaseTextMark
 
-#include <utils/qtcassert.h>
-
 #include <QtCore/QDebug>
 #include <QtCore/QTextStream>
 #include <QtCore/QFileInfo>
diff --git a/src/plugins/debugger/breakhandler.h b/src/plugins/debugger/breakhandler.h
index 747025a5603..5a892f65068 100644
--- a/src/plugins/debugger/breakhandler.h
+++ b/src/plugins/debugger/breakhandler.h
@@ -30,6 +30,8 @@
 #ifndef DEBUGGER_BREAKHANDLER_H
 #define DEBUGGER_BREAKHANDLER_H
 
+#include <utils/qtcassert.h>
+
 #include <QtCore/QObject>
 #include <QtCore/QAbstractItemModel>
 
@@ -121,7 +123,7 @@ public:
 
     QAbstractItemModel *model() { return this; }
 
-    BreakpointData *at(int index) const { return index < size() ? m_bp.at(index) : 0; }
+    BreakpointData *at(int index) const { QTC_ASSERT(index < size(), return 0); return m_bp.at(index); }
     int size() const { return m_bp.size(); }
     bool hasPendingBreakpoints() const;
     void append(BreakpointData *data);
-- 
GitLab