@@ -415,10 +415,14 @@ Error Method::parse_values() {
415
415
new (&values_[i]) EValue (t.get ());
416
416
} break ;
417
417
case executorch_flatbuffer::KernelTypes::TensorList: {
418
+ const auto items =
419
+ static_cast <const executorch_flatbuffer::TensorList*>(val)->items ();
420
+ ET_CHECK_OR_RETURN_ERROR (
421
+ items != nullptr , InvalidProgram, " Missing list at index %zu" , i);
418
422
// get list of serialization tensors and allocate storage for executor
419
423
// tensors
420
424
auto tensors = deserialization::parseTensorList (
421
- static_cast < const executorch_flatbuffer::TensorList*>(val)-> items () ,
425
+ items,
422
426
values_,
423
427
n_value, // The size of the full array.
424
428
memory_manager_);
@@ -433,12 +437,15 @@ Error Method::parse_values() {
433
437
new (&values_[i]) EValue (tensors.get ());
434
438
} break ;
435
439
case executorch_flatbuffer::KernelTypes::OptionalTensorList: {
440
+ const auto items =
441
+ static_cast <const executorch_flatbuffer::OptionalTensorList*>(val)
442
+ ->items ();
443
+ ET_CHECK_OR_RETURN_ERROR (
444
+ items != nullptr , InvalidProgram, " Missing list at index %zu" , i);
436
445
// Same as TensorList but optional<Tensor> instead of Tensor
437
446
auto tensors =
438
447
deserialization::parseListOptionalType<exec_aten::Tensor>(
439
- static_cast <const executorch_flatbuffer::OptionalTensorList*>(
440
- val)
441
- ->items (),
448
+ items,
442
449
values_,
443
450
n_value, // The size of the full array.
444
451
memory_manager_);
0 commit comments