Skip to content

Commit 1e37b99

Browse files
authored
Add basic validation on loading from kernel list (flutter#6921)
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.
1 parent 5c81474 commit 1e37b99

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

shell/common/isolate_configuration.cc

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,14 +164,20 @@ std::unique_ptr<IsolateConfiguration> IsolateConfiguration::InferFromSettings(
164164

165165
// Running from kernel divided into several pieces (for sharing).
166166
{
167+
if (settings.application_kernel_list_asset.empty()) {
168+
FML_LOG(ERROR) << "Application kernel list asset not set";
169+
return nullptr;
170+
}
167171
std::unique_ptr<fml::Mapping> kernel_list =
168172
asset_manager->GetAsMapping(settings.application_kernel_list_asset);
169-
if (kernel_list) {
170-
auto kernel_pieces_paths = ParseKernelListPaths(std::move(kernel_list));
171-
auto kernel_mappings = PrepareKernelMappings(
172-
std::move(kernel_pieces_paths), asset_manager, io_worker);
173-
return CreateForKernelList(std::move(kernel_mappings));
173+
if (!kernel_list) {
174+
FML_LOG(ERROR) << "Failed to load: " << settings.application_kernel_asset;
175+
return nullptr;
174176
}
177+
auto kernel_pieces_paths = ParseKernelListPaths(std::move(kernel_list));
178+
auto kernel_mappings = PrepareKernelMappings(std::move(kernel_pieces_paths),
179+
asset_manager, io_worker);
180+
return CreateForKernelList(std::move(kernel_mappings));
175181
}
176182

177183
return nullptr;

0 commit comments

Comments
 (0)