From 830357f596a7f0ba46e07758ab3896c6f977a0a2 Mon Sep 17 00:00:00 2001 From: Chris Bracken Date: Wed, 21 Nov 2018 09:46:31 -0800 Subject: [PATCH] Add basic validation on loading from kernel list Adds a check/error message for the case where running from kernel list, but application_kernel_list_asset is left unset (or empty). Adds a check/error message for the case where we fail to load the application_kernel_list_asset specified in the settings. --- shell/common/isolate_configuration.cc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/shell/common/isolate_configuration.cc b/shell/common/isolate_configuration.cc index 439eb940af548..59cc56682be9f 100644 --- a/shell/common/isolate_configuration.cc +++ b/shell/common/isolate_configuration.cc @@ -164,14 +164,20 @@ std::unique_ptr IsolateConfiguration::InferFromSettings( // Running from kernel divided into several pieces (for sharing). { + if (settings.application_kernel_list_asset.empty()) { + FML_LOG(ERROR) << "Application kernel list asset not set"; + return nullptr; + } std::unique_ptr kernel_list = asset_manager->GetAsMapping(settings.application_kernel_list_asset); - if (kernel_list) { - auto kernel_pieces_paths = ParseKernelListPaths(std::move(kernel_list)); - auto kernel_mappings = PrepareKernelMappings( - std::move(kernel_pieces_paths), asset_manager, io_worker); - return CreateForKernelList(std::move(kernel_mappings)); + if (!kernel_list) { + FML_LOG(ERROR) << "Failed to load: " << settings.application_kernel_asset; + return nullptr; } + auto kernel_pieces_paths = ParseKernelListPaths(std::move(kernel_list)); + auto kernel_mappings = PrepareKernelMappings(std::move(kernel_pieces_paths), + asset_manager, io_worker); + return CreateForKernelList(std::move(kernel_mappings)); } return nullptr;