[glom] ComboAsRadioButtons::set_choices_with_second(): Avoid use of invalid iterator.
- From: Murray Cumming <murrayc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glom] ComboAsRadioButtons::set_choices_with_second(): Avoid use of invalid iterator.
- Date: Wed, 3 Dec 2014 08:01:14 +0000 (UTC)
commit 51ee66333f2c9397eb5663892c19bc22fc2d58e8
Author: Murray Cumming <murrayc murrayc com>
Date: Wed Dec 3 08:59:08 2014 +0100
ComboAsRadioButtons::set_choices_with_second(): Avoid use of invalid iterator.
Though this would not actually happen.
Found by Coverity Scan.
.../mode_data/datawidget/combo_as_radio_buttons.cc | 22 ++++++++++---------
1 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/glom/mode_data/datawidget/combo_as_radio_buttons.cc
b/glom/mode_data/datawidget/combo_as_radio_buttons.cc
index c1befc4..c580cdb 100644
--- a/glom/mode_data/datawidget/combo_as_radio_buttons.cc
+++ b/glom/mode_data/datawidget/combo_as_radio_buttons.cc
@@ -93,17 +93,19 @@ void ComboAsRadioButtons::set_choices_with_second(const type_list_values_with_se
for(LayoutGroup::type_list_const_items::const_iterator iterExtra = extra_fields.begin();
iterExtra != extra_fields.end(); ++iterExtra)
{
- const sharedptr<const LayoutItem> item = *iterExtra;
- const sharedptr<const LayoutItem_Field> item_field = sharedptr<const
LayoutItem_Field>::cast_dynamic(item);
- if(item_field && (iterValues != extra_values.end()))
- {
- const Gnome::Gda::Value value = *iterValues; //TODO: Use a vector instead?
- const Glib::ustring value_second =
Conversions::get_text_for_gda_value(item_field->get_glom_type(), value,
item_field->get_formatting_used().m_numeric_format);
-
- title += " - " + value_second; //TODO: Find a better way to join them?
+ if(iterValues != extra_values.end()) {
+ const sharedptr<const LayoutItem> item = *iterExtra;
+ const sharedptr<const LayoutItem_Field> item_field = sharedptr<const
LayoutItem_Field>::cast_dynamic(item);
+ if(item_field)
+ {
+ const Gnome::Gda::Value value = *iterValues; //TODO: Use a vector instead?
+ const Glib::ustring value_second =
Conversions::get_text_for_gda_value(item_field->get_glom_type(), value,
item_field->get_formatting_used().m_numeric_format);
+
+ title += " - " + value_second; //TODO: Find a better way to join them?
+ }
+
+ ++iterValues;
}
-
- ++iterValues;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]