Skip to content

Commit 2002dfe

Browse files
lucylqfacebook-github-bot
authored andcommitted
Error checking when NDM is nullptr
Summary: ^ Differential Revision: D77962042
1 parent ed9c4de commit 2002dfe

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

runtime/executor/tensor_parser_exec_aten.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,11 @@ ET_NODISCARD Result<void*> getTensorDataPtr(
194194
} else {
195195
// Mutable value.
196196
// Look up tensor in named data map.
197+
ET_CHECK_OR_RETURN_ERROR(
198+
named_data_map != nullptr,
199+
InvalidExternalData,
200+
"No named data map provided. Cannot retrieve external tensor with fqn %s", fqn
201+
);
197202
Result<const TensorLayout> tensor_layout_res =
198203
named_data_map->get_tensor_layout(fqn);
199204
if (!tensor_layout_res.ok()) {

0 commit comments

Comments
 (0)