IO Graph: Add some vector checks.
authorGerald Combs <gerald@wireshark.org>
Tue, 30 Jan 2018 00:26:13 +0000 (16:26 -0800)
committerAnders Broman <a.broman58@gmail.com>
Wed, 31 Jan 2018 04:52:37 +0000 (04:52 +0000)
Use Qvector::value in a few places instead of an array index.

Change-Id: I821ef4b16df919977739c12ccaa3b9c3d53f049c
Ping-bug: 14357
Reviewed-on: https://code.wireshark.org/review/25511
Reviewed-by: Gerald Combs <gerald@wireshark.org>
Petri-Dish: Gerald Combs <gerald@wireshark.org>
Tested-by: Petri Dish Buildbot
Reviewed-by: Anders Broman <a.broman58@gmail.com>
ui/qt/io_graph_dialog.cpp

index 749ceb2420fa875901644fb64c6f2b2dc18de45f..c974a5ea7e71beb4f8fd9dbeb081aebc44045c61 100644 (file)
@@ -789,14 +789,14 @@ IOGraph *IOGraphDialog::currentActiveGraph() const
 {
     QModelIndex index = ui->graphUat->currentIndex();
     if (index.isValid()) {
-        return ioGraphs_[index.row()];
+        return ioGraphs_.value(index.row(), NULL);
     }
 
     //if no currently selected item, go with first item enabled
     for (int row = 0; row < uat_model_->rowCount(); row++)
     {
         if (graphIsEnabled(row)) {
-            return ioGraphs_[row];
+            return ioGraphs_.value(row, NULL);
         }
     }
 
@@ -1171,7 +1171,7 @@ void IOGraphDialog::on_intervalComboBox_currentIndexChanged(int)
 
     if (uat_model_ != NULL) {
         for (int row = 0; row < uat_model_->rowCount(); row++) {
-            IOGraph *iog = ioGraphs_[row];
+            IOGraph *iog = ioGraphs_.value(row, NULL);
             if (iog) {
                 iog->setInterval(interval);
                 if (iog->visible()) {