4
0
mirror of https://github.com/QuasarApp/LIEF.git synced 2025-05-07 09:19:34 +00:00

Merge pull request from kohnakagawa/fix/handle_empty_dialog

fix to parse the files that have empty dialogs and langs
This commit is contained in:
Romain 2020-05-28 06:20:42 +02:00 committed by GitHub
commit 565593dade
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1010,10 +1010,18 @@ std::vector<ResourceDialog> ResourcesManager::dialogs(void) const {
for (size_t i = 0; i < nodes.size(); ++i) {
const ResourceDirectory* dialog = dynamic_cast<const ResourceDirectory*>(&nodes[i]);
if (!dialog) {
LOG(WARNING) << "Dialog is empty. Skipping";
continue;
}
it_const_childs langs = dialog->childs();
for (size_t j = 0; j < langs.size(); ++j) {
const ResourceData* data_node = dynamic_cast<const ResourceData*>(&langs[j]);
if (!data_node) {
LOG(WARNING) << "Dialog is empty. Skipping";
continue;
}
const std::vector<uint8_t>& content = data_node->content();
VectorStream stream{content};
stream.setpos(0);