From 5dc3fd1cc43883c0d41bebf1e5ee229dd1c24cc5 Mon Sep 17 00:00:00 2001 From: John Smith Date: Tue, 24 Apr 2012 15:09:59 +0900 Subject: Fix for 943275 : OCAL search crash when data not avaialable (bzr r11289) --- src/ui/dialog/ocaldialogs.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/ui') diff --git a/src/ui/dialog/ocaldialogs.cpp b/src/ui/dialog/ocaldialogs.cpp index 4c9245f5c..9dccb9c85 100644 --- a/src/ui/dialog/ocaldialogs.cpp +++ b/src/ui/dialog/ocaldialogs.cpp @@ -879,9 +879,11 @@ void SearchResultList::populate_from_xml(xmlNode * a_node) guint row_num = 0; for (xmlNode *cur_node = a_node; cur_node; cur_node = cur_node->next) { + // Get items information if (strcmp((const char*)cur_node->name, "rss")) // Avoid the root - if (cur_node->type == XML_ELEMENT_NODE && !strcmp((const char*)cur_node->parent->name, "item")) + if (cur_node->type == XML_ELEMENT_NODE && + (cur_node->parent->name && !strcmp((const char*)cur_node->parent->name, "item"))) { if (!strcmp((const char*)cur_node->name, "title")) { @@ -1055,7 +1057,7 @@ void ImportDialog::on_xml_file_read(const Glib::RefPtr& result list_results->populate_from_xml(root_element); // Populate the MARKUP column with the title & description of the clipart - for (guint i = 0; i <= list_results->size() - 1; i++) { + for (guint i = 0; i < list_results->size(); i++) { Glib::ustring title = list_results->get_text(i, RESULTS_COLUMN_TITLE); Glib::ustring description = list_results->get_text(i, RESULTS_COLUMN_DESCRIPTION); char* markup = g_markup_printf_escaped("%s\n%s", -- cgit v1.2.3