mirror of
https://github.com/overte-org/overte.git
synced 2025-04-08 12:52:45 +02:00
Fix crash on 0 size assets
This commit is contained in:
parent
cb3456195e
commit
60bb3f49c9
1 changed files with 6 additions and 4 deletions
|
@ -79,11 +79,13 @@ void copyAsset(const char* sourceAsset, const QString& destFilename) {
|
|||
if (!file.resize(size)) {
|
||||
throw std::runtime_error("Unable to resize output file");
|
||||
}
|
||||
auto mapped = file.map(0, size);
|
||||
if (!mapped) {
|
||||
throw std::runtime_error("Unable to map output file");
|
||||
if (size != 0) {
|
||||
auto mapped = file.map(0, size);
|
||||
if (!mapped) {
|
||||
throw std::runtime_error("Unable to map output file");
|
||||
}
|
||||
memcpy(mapped, data, size);
|
||||
}
|
||||
memcpy(mapped, data, size);
|
||||
file.close();
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue