Fix error message handling in LoadRomComponent for better string management
- Updated the error message assignment in LoadRomComponent to ensure proper string handling by explicitly constructing a std::string from the message data. - This change improves the robustness of error reporting when loading ROM files.
This commit is contained in:
@@ -532,7 +532,7 @@ void LoadRomComponent(ftxui::ScreenInteractive &screen) {
|
|||||||
// Load the ROM file here.
|
// Load the ROM file here.
|
||||||
auto rom_status = app_context.rom.LoadFromFile(rom_file);
|
auto rom_status = app_context.rom.LoadFromFile(rom_file);
|
||||||
if (!rom_status.ok()) {
|
if (!rom_status.ok()) {
|
||||||
app_context.error_message = rom_status.message();
|
app_context.error_message = std::string(rom_status.message().data(), rom_status.message().size());
|
||||||
SwitchComponents(screen, LayoutID::kError);
|
SwitchComponents(screen, LayoutID::kError);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user