From 02bdf755a3cda3c06daff3a7cb0b94a987ccb435 Mon Sep 17 00:00:00 2001 From: Alexander Shaduri Date: Thu, 25 Apr 2024 16:44:25 +0400 Subject: [PATCH] Fixed crash on reload; tables still to be fixed. --- src/gsc_info_window.cpp | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/src/gsc_info_window.cpp b/src/gsc_info_window.cpp index 923336c..f2d81d7 100644 --- a/src/gsc_info_window.cpp +++ b/src/gsc_info_window.cpp @@ -1760,6 +1760,9 @@ void GscInfoWindow::cell_renderer_for_attributes(Gtk::CellRenderer* cr, const Gtk::TreeModel::iterator& iter, [[maybe_unused]] int column_index) const { const AtaStorageProperty* prop = (*iter)[this->attribute_table_columns.storage_property]; + if (!prop) { + return; + } const auto& attribute = prop->get_value(); if (auto* crt = dynamic_cast(cr)) { @@ -1809,6 +1812,9 @@ void GscInfoWindow::cell_renderer_for_statistics(Gtk::CellRenderer* cr, const Gtk::TreeModel::iterator& iter, [[maybe_unused]] int column_index) const { const AtaStorageProperty* prop = (*iter)[this->statistics_table_columns.storage_property]; + if (!prop) { + return; + } const auto& statistic = prop->get_value(); if (auto* crt = dynamic_cast(cr)) { @@ -1839,6 +1845,9 @@ void GscInfoWindow::cell_renderer_for_self_test_log(Gtk::CellRenderer* cr, const Gtk::TreeModel::iterator& iter, [[maybe_unused]] int column_index) const { const AtaStorageProperty* prop = (*iter)[this->self_test_log_table_columns.storage_property]; + if (!prop) { + return; + } if (auto* crt = dynamic_cast(cr)) { cell_renderer_set_warning_fg_bg(crt, *prop); @@ -1870,6 +1879,9 @@ void GscInfoWindow::cell_renderer_for_error_log(Gtk::CellRenderer* cr, const Gtk::TreeModel::iterator& iter, [[maybe_unused]] int column_index) const { const AtaStorageProperty* prop = (*iter)[this->error_log_table_columns.storage_property]; + if (!prop) { + return; + } if (auto* crt = dynamic_cast(cr)) { cell_renderer_set_warning_fg_bg(crt, *prop); @@ -1896,6 +1908,9 @@ void GscInfoWindow::cell_renderer_for_capabilities(Gtk::CellRenderer* cr, const Gtk::TreeModel::iterator& iter, [[maybe_unused]] int column_index) const { const AtaStorageProperty* prop = (*iter)[this->capabilities_table_columns.storage_property]; + if (!prop) { + return; + } if (auto* crt = dynamic_cast(cr)) { cell_renderer_set_warning_fg_bg(crt, *prop); @@ -2231,7 +2246,7 @@ void GscInfoWindow::on_treeview_menu_copy_clicked(Gtk::TreeView* treeview) { std::string text; - int num_cols = static_cast(treeview->get_n_columns()); + const int num_cols = static_cast(treeview->get_n_columns()); std::vector col_texts; for (int i = 0; i < num_cols; ++i) { Gtk::TreeViewColumn* tcol = treeview->get_column(i);