Avoid dereferencing a null pointer when the operation is missing.

PiperOrigin-RevId: 338073270
Change-Id: I775ef60523186f4394d0e46bbabe5a752d638e34
This commit is contained in:
A. Unique TensorFlower 2020-10-20 09:21:20 -07:00 committed by TensorFlower Gardener
parent 4f7ef4ecb4
commit 9b5e180a69

View File

@ -3606,16 +3606,18 @@ PyObject* TFE_Py_FastPathExecute_C(PyObject* args) {
}
TFE_Op* op = GetOp(ctx, op_name, op_exec_info.device_name, status);
tensorflow::unwrap(op)->SetStackTrace(tensorflow::GetStackTrace());
auto cleaner = tensorflow::gtl::MakeCleanup([status, ctx, op] {
ReturnStatus(status);
ReturnOp(ctx, op);
});
if (MaybeRaiseExceptionFromTFStatus(status, nullptr)) {
return nullptr;
}
tensorflow::unwrap(op)->SetStackTrace(tensorflow::GetStackTrace());
const tensorflow::OpDef* op_def = tensorflow::unwrap(op)->OpDef();
if (op_def == nullptr) return nullptr;