From 6c55164be4c1d830f3df9a593fa6e7abd12eb19f Mon Sep 17 00:00:00 2001 From: lethosor Date: Fri, 24 Jul 2015 10:54:59 -0400 Subject: [PATCH] Fix a potential crash in tweak farm-plot-select Related to #396 --- plugins/tweak/tweaks/farm-plot-select.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plugins/tweak/tweaks/farm-plot-select.h b/plugins/tweak/tweaks/farm-plot-select.h index 063180c75..11d772450 100644 --- a/plugins/tweak/tweaks/farm-plot-select.h +++ b/plugins/tweak/tweaks/farm-plot-select.h @@ -53,9 +53,9 @@ struct farm_select_hook : df::viewscreen_dwarfmodest { DEFINE_VMETHOD_INTERPOSE(void, feed, (set *input)) { df::building_farmplotst* farm_plot = getFarmPlot(); - if (farm_plot) + if (farm_plot && ui->selected_farm_crops.size() > 0) { - if (input->count(interface_key::SELECT_ALL) && ui->selected_farm_crops.size() > 0) + if (input->count(interface_key::SELECT_ALL)) { int32_t crop_id = getSelectedCropId(); for (int season = 0; season < 4; season++) @@ -80,7 +80,7 @@ struct farm_select_hook : df::viewscreen_dwarfmodest { DEFINE_VMETHOD_INTERPOSE(void, render, ()) { INTERPOSE_NEXT(render)(); - if (!getFarmPlot()) + if (!getFarmPlot() || !ui->selected_farm_crops.size()) return; auto dims = Gui::getDwarfmodeViewDims(); int x = dims.menu_x1 + 1,