Author: cazfi
Date: Tue Jan  5 16:41:45 2016
New Revision: 31364

URL: http://svn.gna.org/viewcvs/freeciv?rev=31364&view=rev
Log:
Fixed ruledit crash when trying to delete an item without one selected.

See bug #24272

Modified:
    trunk/tools/ruledit/tab_building.cpp
    trunk/tools/ruledit/tab_tech.cpp
    trunk/tools/ruledit/tab_unit.cpp

Modified: trunk/tools/ruledit/tab_building.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/tab_building.cpp?rev=31364&r1=31363&r2=31364&view=diff
==============================================================================
--- trunk/tools/ruledit/tab_building.cpp        (original)
+++ trunk/tools/ruledit/tab_building.cpp        Tue Jan  5 16:41:45 2016
@@ -162,17 +162,19 @@
 **************************************************************************/
 void tab_building::delete_now()
 {
-  requirers_dlg *requirers;
-
-  requirers = ui->create_requirers(improvement_rule_name(selected));
-  if (is_building_needed(selected, &ruledit_qt_display_requirers, requirers)) {
-    return;
-  }
-
-  selected->disabled = true;
-
-  refresh();
-  update_bldg_info(0);
+  if (selected != 0) {
+    requirers_dlg *requirers;
+
+    requirers = ui->create_requirers(improvement_rule_name(selected));
+    if (is_building_needed(selected, &ruledit_qt_display_requirers, 
requirers)) {
+      return;
+    }
+
+    selected->disabled = true;
+
+    refresh();
+    update_bldg_info(0);
+  }
 }
 
 /**************************************************************************

Modified: trunk/tools/ruledit/tab_tech.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/tab_tech.cpp?rev=31364&r1=31363&r2=31364&view=diff
==============================================================================
--- trunk/tools/ruledit/tab_tech.cpp    (original)
+++ trunk/tools/ruledit/tab_tech.cpp    Tue Jan  5 16:41:45 2016
@@ -326,17 +326,19 @@
 **************************************************************************/
 void tab_tech::delete_now()
 {
-  requirers_dlg *requirers;
-
-  requirers = ui->create_requirers(advance_rule_name(selected));
-  if (is_tech_needed(selected, &ruledit_qt_display_requirers, requirers)) {
-    return;
-  }
-
-  selected->require[AR_ONE] = A_NEVER;
-
-  refresh();
-  update_tech_info(0);
+  if (selected != 0) {
+    requirers_dlg *requirers;
+
+    requirers = ui->create_requirers(advance_rule_name(selected));
+    if (is_tech_needed(selected, &ruledit_qt_display_requirers, requirers)) {
+      return;
+    }
+
+    selected->require[AR_ONE] = A_NEVER;
+
+    refresh();
+    update_tech_info(0);
+  }
 }
 
 /**************************************************************************

Modified: trunk/tools/ruledit/tab_unit.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/tab_unit.cpp?rev=31364&r1=31363&r2=31364&view=diff
==============================================================================
--- trunk/tools/ruledit/tab_unit.cpp    (original)
+++ trunk/tools/ruledit/tab_unit.cpp    Tue Jan  5 16:41:45 2016
@@ -169,17 +169,19 @@
 **************************************************************************/
 void tab_unit::delete_now()
 {
-  requirers_dlg *requirers;
-
-  requirers = ui->create_requirers(utype_rule_name(selected));
-  if (is_utype_needed(selected, &ruledit_qt_display_requirers, requirers)) {
-    return;
-  }
-
-  selected->disabled = true;
-
-  refresh();
-  update_utype_info(0);
+  if (selected != 0) {
+    requirers_dlg *requirers;
+
+    requirers = ui->create_requirers(utype_rule_name(selected));
+    if (is_utype_needed(selected, &ruledit_qt_display_requirers, requirers)) {
+      return;
+    }
+
+    selected->disabled = true;
+
+    refresh();
+    update_utype_info(0);
+  }
 }
 
 /**************************************************************************


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to