Fix possible segfault with ShapeHandle.
PiperOrigin-RevId: 283605264 Change-Id: I4531583f987439338f3207697f388fd1c74ccf23
This commit is contained in:
parent
08266e2d23
commit
0c3af9326f
@ -306,7 +306,7 @@ class InferenceContext {
|
|||||||
// idx can be negative for an offset from end of dimensions.
|
// idx can be negative for an offset from end of dimensions.
|
||||||
// idx must be in the range [-1 * s.rank, s.rank).
|
// idx must be in the range [-1 * s.rank, s.rank).
|
||||||
DimensionHandle Dim(ShapeHandle s, int64 idx) {
|
DimensionHandle Dim(ShapeHandle s, int64 idx) {
|
||||||
if (s->rank_ == kUnknownRank) {
|
if (!s.Handle() || s->rank_ == kUnknownRank) {
|
||||||
return UnknownDim();
|
return UnknownDim();
|
||||||
}
|
}
|
||||||
return DimKnownRank(s, idx);
|
return DimKnownRank(s, idx);
|
||||||
|
Loading…
Reference in New Issue
Block a user