Skip to content

Commit a067adc

Browse files
committed
.
1 parent 403644b commit a067adc

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

CImg.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18234,6 +18234,7 @@ namespace cimg_library {
1823418234
if (*ss=='_' && *ss1=='0') { // _0
1823518235
if (reserved_label[34]!=~0U) _cimg_mp_return(reserved_label[34]);
1823618236
if (_0_index==~0U) {
18237+
if (imgin.is_empty()) _cimg_mp_return_nan();
1823718238
_0_index = vector(imgin._spectrum);
1823818239
std::memset(&mem[_0_index] + 1,0,imgin._spectrum*sizeof(double));
1823918240
set_reserved_vector(_0_index);
@@ -18243,6 +18244,7 @@ namespace cimg_library {
1824318244
if (*ss=='_' && *ss1=='1') { // _1
1824418245
if (reserved_label[35]!=~0U) _cimg_mp_return(reserved_label[35]);
1824518246
if (_1_index==~0U) {
18247+
if (imgin.is_empty()) _cimg_mp_return_nan();
1824618248
_1_index = vector(imgin._spectrum);
1824718249
cimg_forC(imgin,c) mem[_1_index + 1 + c] = 1.0;
1824818250
set_reserved_vector(_1_index);
@@ -25597,6 +25599,7 @@ namespace cimg_library {
2559725599

2559825600
// Insert new vector of specified size in memory.
2559925601
unsigned int vector(const unsigned int siz) {
25602+
if (!siz) return _cimg_mp_slot_nan;
2560025603
if (mempos + siz>=mem._width) {
2560125604
mem.resize(2*mem._width + siz,1,1,1,0);
2560225605
memtype.resize(mem._width,1,1,1,0);

0 commit comments

Comments
 (0)