Fix a potential crash in tweak farm-plot-select

Related to #396
develop
lethosor 2015-07-24 10:54:59 -04:00
parent bbe2002a28
commit 6c55164be4
1 changed files with 3 additions and 3 deletions

@ -53,9 +53,9 @@ struct farm_select_hook : df::viewscreen_dwarfmodest {
DEFINE_VMETHOD_INTERPOSE(void, feed, (set<df::interface_key> *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,