Merge pull request #3463 from plule/fix/rfr_null_image

RemoteFortressReader: Fix a null pointer access on image descriptions
develop
Myk 2023-06-10 14:28:32 -07:00 committed by GitHub
commit 367475ca6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

@ -37,6 +37,7 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
## Fixes
- `dig-now`: clear item occupancy flags for channeled tiles that had items on them
- `RemoteFortressReader`: fix a crash with engraving without image
## Misc Improvements
- `autonick`: additional nicknames based on burrowing animals, colours, gems and minerals added

@ -248,7 +248,7 @@ void CopyItem(RemoteFortressReader::Item * NetItem, df::item * DfItem)
chunk = world->art_image_chunks[i];
}
}
if (chunk)
if (chunk && chunk->images[statue->image.subid])
{
CopyImage(chunk->images[statue->image.subid], NetItem->mutable_image());
}
@ -462,7 +462,10 @@ void CopyItem(RemoteFortressReader::Item * NetItem, df::item * DfItem)
case df::enums::improvement_type::ART_IMAGE:
{
VIRTUAL_CAST_VAR(artImage, df::itemimprovement_art_imagest, improvement);
CopyImage(artImage->getImage(DfItem), netImp->mutable_image());
auto image = artImage->getImage(DfItem);
if (image) {
CopyImage(image, netImp->mutable_image());
}
break;
}
case df::enums::improvement_type::COVERED:

@ -1530,7 +1530,9 @@ static command_result GetBlockList(color_ostream &stream, const BlockRequest *in
ConvertDFCoord(engraving->pos, netEngraving->mutable_pos());
netEngraving->set_quality(engraving->quality);
netEngraving->set_tile(engraving->tile);
if (chunk->images[engraving->art_subid]) {
CopyImage(chunk->images[engraving->art_subid], netEngraving->mutable_image());
}
netEngraving->set_floor(engraving->flags.bits.floor);
netEngraving->set_west(engraving->flags.bits.west);
netEngraving->set_east(engraving->flags.bits.east);