Skip to content

Commit 9c87418

Browse files
committed
[libs][matrix] check for size before filling the matrix
1 parent e08cd8c commit 9c87418

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

libs/libvtrutil/src/vtr_ndmatrix.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,9 @@ class NdMatrixBase {
248248
public: //Mutators
249249
///@brief Set all elements to 'value'
250250
void fill(T value) {
251-
std::fill(data_.get(), data_.get() + size(), value);
251+
if (size() > 0) {
252+
std::fill(data_.get(), data_.get() + size(), value);
253+
}
252254
}
253255

254256
/**

0 commit comments

Comments
 (0)