Skip to content

Commit c43498c

Browse files
committed
check vector emptiness before access it
Signed-off-by: Li Peng <[email protected]>
1 parent 389fa5d commit c43498c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

modules/dnn/src/dnn.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1266,8 +1266,11 @@ struct Net::Impl
12661266

12671267
if ( preferableTarget == DNN_TARGET_OPENCL )
12681268
{
1269-
nextData = &layers[activData->consumers[0].lid];
1270-
lpNext = LayerPin(activData->consumers[0].lid, 0);
1269+
if ( !activData->consumers.empty() )
1270+
{
1271+
nextData = &layers[activData->consumers[0].lid];
1272+
lpNext = LayerPin(activData->consumers[0].lid, 0);
1273+
}
12711274
}
12721275
}
12731276
}

0 commit comments

Comments
 (0)