mirror of
https://github.com/RGBCube/serenity
synced 2025-06-20 02:52:08 +00:00
Magnifier: Don't error if cancelling capture save
This commit is contained in:
parent
540c307009
commit
ddfe18783b
1 changed files with 4 additions and 1 deletions
|
@ -63,7 +63,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
TRY(file_menu->try_add_action(GUI::CommonActions::make_save_as_action([&](auto&) {
|
TRY(file_menu->try_add_action(GUI::CommonActions::make_save_as_action([&](auto&) {
|
||||||
AK::String filename = "file for saving";
|
AK::String filename = "file for saving";
|
||||||
auto do_save = [&]() -> ErrorOr<void> {
|
auto do_save = [&]() -> ErrorOr<void> {
|
||||||
auto file = TRY(FileSystemAccessClient::Client::the().try_save_file(window, "Capture", "png"));
|
auto response = FileSystemAccessClient::Client::the().try_save_file(window, "Capture", "png");
|
||||||
|
if (response.is_error())
|
||||||
|
return {};
|
||||||
|
auto file = response.release_value();
|
||||||
auto path = AK::LexicalPath(file->filename());
|
auto path = AK::LexicalPath(file->filename());
|
||||||
filename = path.basename();
|
filename = path.basename();
|
||||||
auto encoded = TRY(dump_bitmap(magnifier->current_bitmap(), path.extension()));
|
auto encoded = TRY(dump_bitmap(magnifier->current_bitmap(), path.extension()));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue