From 554f96350e1ffdc1d0c7135e9ae4dac23958c753 Mon Sep 17 00:00:00 2001 From: Steveice10 Date: Fri, 6 Jan 2017 18:24:13 -0800 Subject: [PATCH] Display error if target file item could not be created for bulk operations. --- source/ui/section/action/deletecontents.c | 9 ++++++++- source/ui/section/action/installcias.c | 9 ++++++++- source/ui/section/action/installtickets.c | 9 ++++++++- source/ui/section/action/pastecontents.c | 9 ++++++++- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/source/ui/section/action/deletecontents.c b/source/ui/section/action/deletecontents.c index b4f4b8a..a10338b 100644 --- a/source/ui/section/action/deletecontents.c +++ b/source/ui/section/action/deletecontents.c @@ -207,7 +207,14 @@ static void action_delete_internal(linked_list* items, list_item* selected, cons data->items = items; file_info* targetInfo = (file_info*) selected->data; - task_create_file_item(&data->targetItem, targetInfo->archive, targetInfo->path, targetInfo->attributes); + Result targetCreateRes = task_create_file_item(&data->targetItem, targetInfo->archive, targetInfo->path, targetInfo->attributes); + if(R_FAILED(targetCreateRes)) { + error_display_res(NULL, NULL, targetCreateRes, "Failed to create target file item."); + + action_delete_free_data(data); + return; + } + data->target = (file_info*) data->targetItem->data; data->deleteInfo.data = data; diff --git a/source/ui/section/action/installcias.c b/source/ui/section/action/installcias.c index ddc8aba..cce5e27 100644 --- a/source/ui/section/action/installcias.c +++ b/source/ui/section/action/installcias.c @@ -321,7 +321,14 @@ static void action_install_cias_internal(linked_list* items, list_item* selected data->items = items; file_info* targetInfo = (file_info*) selected->data; - task_create_file_item(&data->targetItem, targetInfo->archive, targetInfo->path, targetInfo->attributes); + Result targetCreateRes = task_create_file_item(&data->targetItem, targetInfo->archive, targetInfo->path, targetInfo->attributes); + if(R_FAILED(targetCreateRes)) { + error_display_res(NULL, NULL, targetCreateRes, "Failed to create target file item."); + + action_install_cias_free_data(data); + return; + } + data->target = (file_info*) data->targetItem->data; data->delete = delete; diff --git a/source/ui/section/action/installtickets.c b/source/ui/section/action/installtickets.c index ab35e19..96fdb03 100644 --- a/source/ui/section/action/installtickets.c +++ b/source/ui/section/action/installtickets.c @@ -287,7 +287,14 @@ static void action_install_tickets_internal(linked_list* items, list_item* selec data->items = items; file_info* targetInfo = (file_info*) selected->data; - task_create_file_item(&data->targetItem, targetInfo->archive, targetInfo->path, targetInfo->attributes); + Result targetCreateRes = task_create_file_item(&data->targetItem, targetInfo->archive, targetInfo->path, targetInfo->attributes); + if(R_FAILED(targetCreateRes)) { + error_display_res(NULL, NULL, targetCreateRes, "Failed to create target file item."); + + action_install_tickets_free_data(data); + return; + } + data->target = (file_info*) data->targetItem->data; data->delete = delete; diff --git a/source/ui/section/action/pastecontents.c b/source/ui/section/action/pastecontents.c index 8f75679..4a05bbb 100644 --- a/source/ui/section/action/pastecontents.c +++ b/source/ui/section/action/pastecontents.c @@ -357,7 +357,14 @@ void action_paste_contents(linked_list* items, list_item* selected) { data->items = items; file_info* targetInfo = (file_info*) selected->data; - task_create_file_item(&data->targetItem, targetInfo->archive, targetInfo->path, targetInfo->attributes); + Result targetCreateRes = task_create_file_item(&data->targetItem, targetInfo->archive, targetInfo->path, targetInfo->attributes); + if(R_FAILED(targetCreateRes)) { + error_display_res(NULL, NULL, targetCreateRes, "Failed to create target file item."); + + action_paste_contents_free_data(data); + return; + } + data->target = (file_info*) data->targetItem->data; data->pasteInfo.data = data;