Merge lp:~widelands-dev/widelands/bug-1815664-crash-conquer-tower into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 8991
Proposed branch: lp:~widelands-dev/widelands/bug-1815664-crash-conquer-tower
Merge into: lp:widelands
Diff against target: 23 lines (+10/-2)
1 file modified
src/logic/map_objects/tribes/worker.cc (+10/-2)
To merge this branch: bzr merge lp:~widelands-dev/widelands/bug-1815664-crash-conquer-tower
Reviewer Review Type Date Requested Status
hessenfarmer Approve
Toni Förster tested Approve
Review via email: mp+363296@code.launchpad.net

Commit message

Stop ware dropoff when the target building has been destroyed.

This fixes a crash when the enemy conquers a militarysite near a warehouse.

To post a comment you must log in.
Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4489. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/494551119.
Appveyor build 4277. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1815664_crash_conquer_tower-4277.

Revision history for this message
Toni Förster (stonerl) :
review: Approve (tested)
8984. By hessenfarmer

merged trunk

Revision history for this message
hessenfarmer (stephan-lutz) wrote :

tested this and it is working fine savegame loads and can be played without crash.

@bunnybot merge

review: Approve
Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 4515. State: failed. Details: https://travis-ci.org/widelands/widelands/builds/497605494.
Appveyor build 4302. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_bug_1815664_crash_conquer_tower-4302.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Refusing to merge, since Travis is not green. Use @bunnybot merge force for merging anyways.

Travis build 4515. State: failed. Details: https://travis-ci.org/widelands/widelands/builds/497605494.

8985. By hessenfarmer

merged trunk to please clang

Revision history for this message
hessenfarmer (stephan-lutz) wrote :

travis failure after last merge is transient.

@bunnybot merge force

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/logic/map_objects/tribes/worker.cc'
2--- src/logic/map_objects/tribes/worker.cc 2019-02-23 11:00:49 +0000
3+++ src/logic/map_objects/tribes/worker.cc 2019-02-24 09:49:54 +0000
4@@ -2051,9 +2051,17 @@
5
6 WareInstance* ware = get_carried_ware(game);
7 BaseImmovable* const location = game.map()[get_position()].get_immovable();
8+
9+ // If the building just got destroyed, pop the task
10+ PlayerImmovable* current_location = get_location(game);
11+ if (current_location == nullptr) {
12+ molog("%s: Unable to dropoff ware in building at (%d,%d) - there is no building there\n", descr().name().c_str(), get_position().x, get_position().y);
13+ return pop_task(game);
14+ }
15+
16 #ifndef NDEBUG
17- Building& ploc = dynamic_cast<Building&>(*get_location(game));
18- assert(&ploc == location || &ploc.base_flag() == location);
19+ Building* ploc = dynamic_cast<Building*>(current_location);
20+ assert(ploc == location || &ploc->base_flag() == location);
21 #endif
22
23 // Deliver the ware

Subscribers

People subscribed via source and target branches

to status/vote changes: