Merge pull request #8108 from lioncash/use-after-move

Core/Boot/Boot: Amend use-after-move cases in GenerateFromFile()
This commit is contained in:
Léo Lam 2019-05-21 18:39:15 +02:00 committed by GitHub
commit 99ba260b51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 5 deletions

View File

@ -155,7 +155,7 @@ BootParameters::GenerateFromFile(std::vector<std::string> paths,
std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower); std::transform(extension.begin(), extension.end(), extension.begin(), ::tolower);
} }
const std::string path = paths.front(); std::string path = paths.front();
if (paths.size() == 1) if (paths.size() == 1)
paths.clear(); paths.clear();
@ -172,14 +172,16 @@ BootParameters::GenerateFromFile(std::vector<std::string> paths,
if (extension == ".elf") if (extension == ".elf")
{ {
return std::make_unique<BootParameters>( auto elf_reader = std::make_unique<ElfReader>(path);
Executable{std::move(path), std::make_unique<ElfReader>(path)}, savestate_path); return std::make_unique<BootParameters>(Executable{std::move(path), std::move(elf_reader)},
savestate_path);
} }
if (extension == ".dol") if (extension == ".dol")
{ {
return std::make_unique<BootParameters>( auto dol_reader = std::make_unique<DolReader>(path);
Executable{std::move(path), std::make_unique<DolReader>(path)}, savestate_path); return std::make_unique<BootParameters>(Executable{std::move(path), std::move(dol_reader)},
savestate_path);
} }
if (is_drive) if (is_drive)