mirror of
https://github.com/zhenyan121/SporeBG-Conid.git
synced 2026-04-09 22:06:09 +08:00
fix: use-after-free crash after piece death
This commit is contained in:
@@ -117,12 +117,13 @@ bool GameSession::executeAction(int toRow, int toCol) {
|
||||
if (fromPiece->getHP() <= 0) {
|
||||
m_gamePieceEventCallback(GamePieceEvent::REMOVE_PIECE, fromRow, fromCol, -1, -1);
|
||||
m_board->removePieceAt(fromRow, fromCol);
|
||||
fromPiece = nullptr;
|
||||
}
|
||||
if (toPiece->getHP() <= 0) {
|
||||
m_gamePieceEventCallback(GamePieceEvent::REMOVE_PIECE, toRow, toCol, -1, -1);
|
||||
m_board->removePieceAt(toRow, toCol);
|
||||
|
||||
if (fromPiece->getHP() > 0) {
|
||||
toPiece = nullptr;
|
||||
if (fromPiece && fromPiece->getHP() > 0) {
|
||||
m_gamePieceEventCallback(GamePieceEvent::MOVE_PIECE, fromRow, fromCol, toRow, toCol);
|
||||
|
||||
auto fromInfo = fromPiece->getPieceInfo();
|
||||
|
||||
Reference in New Issue
Block a user