Skip to content

Commit 87dba50

Browse files
authored
Error checking when NDM is nullptr
Differential Revision: D77962042 Pull Request resolved: #12286
1 parent dd43946 commit 87dba50

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+
"Cannot retrieve external tensor with fqn: %s. The named_data_map is null; most likely no external .ptd file was provided.",
201+
fqn);
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)