mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 16:58:09 +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)) {
|
if (!file.resize(size)) {
|
||||||
throw std::runtime_error("Unable to resize output file");
|
throw std::runtime_error("Unable to resize output file");
|
||||||
}
|
}
|
||||||
|
if (size != 0) {
|
||||||
auto mapped = file.map(0, size);
|
auto mapped = file.map(0, size);
|
||||||
if (!mapped) {
|
if (!mapped) {
|
||||||
throw std::runtime_error("Unable to map output file");
|
throw std::runtime_error("Unable to map output file");
|
||||||
}
|
}
|
||||||
memcpy(mapped, data, size);
|
memcpy(mapped, data, size);
|
||||||
|
}
|
||||||
file.close();
|
file.close();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue