Yalantis/uCrop · error · CImgArgumentException
[" cimg_appname "_math_parser] CImg<
Error message
[" cimg_appname "_math_parser] CImg<%s>: Function '%s()': Images list cannot be empty.
What it means
mp_check_list is the static variant of the empty-image-list check, used by named math-parser functions. It throws CImgArgumentException when the function is called with an empty image list, naming the offending function (funcname). Like error 153, it guards functions whose semantics require at least one image.
Solutions
- Populate the image list before evaluating the expression.
- Verify the function actually requires an image and your use case provides one.
- Check earlier load/assign calls for silent failures leaving the list empty.
- Wrap evaluation in try/catch to report which function required the list.
Example fix
// before
CImgList<float> imgs; // empty
imgs(0).fill("da_freeze()");
// after
CImgList<float> imgs(1); imgs(0).assign(4,1,1,1,0);
imgs(0).fill("da_freeze()"); Defensive patterns
Strategy: validation
Validate before calling
if (imgs.size() == 0) throw std::runtime_error("image list empty for function call"); Type guard
bool hasImages(const CImgList<T>& l) { return l.size() > 0 && !l(0).is_empty(); } Try / catch
try { imgs(0).fill(expr); } catch (const cimg_library::CImgArgumentException& e) { /* populate list first */ } Prevention
- Verify CImgList is populated before named MP functions
- Handle load failures that leave lists empty
- Create placeholder images when needed
When it happens
Trigger: Calling list-dependent MP functions such as 'da_freeze()', 'da_push()' variants, or similar named functions via an expression evaluated with an empty CImgList.
Common situations: Dynamic-array helper functions invoked before any image was assigned; failure to propagate a loaded image list into the parser context.
Understand the failure class
Background: "must not be empty", "cannot be empty" — required-field validation errors across open-source libraries — this error's family across 41 libraries.
Related errors
- [" cimg_appname "_math_parser] CImg<
- "[" cimg_appname "_math_parser] CImg<
- [" cimg_appname "_math_parser] CImg<
- [" cimg_appname "_math_parser] CImg<
- "[" cimg_appname "_math_parser] CImg<
AI-assisted analysis of Yalantis/uCrop@f788b534b4 (2026-09-08).
Data as JSON: /api/errors/6f6738493fbddc50.
Report an issue: GitHub.
Appendix: source
Thrown at ucrop/src/main/jni/CImg.h:25275
s_arg,*s_op=='F'?(*s_arg?" argument":" Argument"):(*s_arg?" operand":" Operand"),
s_type(arg)._data,sb_type._data,s0);
}
}
// Check that imglist are not empty.
void check_list(char *const ss, char *const se, const char saved_char) {
if (!imglist) {
char *s0;
_cimg_mp_strerr;
throw CImgArgumentException("[" cimg_appname "_math_parser] "
"CImg<%s>::%s: %s%s Image list cannot be empty, for expression '%s'.",
pixel_type(),_cimg_mp_calling_function,s_op,*s_op?":":"",s0);
}
}
static void mp_check_list(_cimg_math_parser& mp, const char *const funcname) {
if (!mp.imglist)
throw CImgArgumentException("[" cimg_appname "_math_parser] "
"CImg<%s>: Function '%s()': Images list cannot be empty.",
pixel_type(),funcname);
}
// Insert constant value in memory.
unsigned int const_scalar(const double val) {
// Search for built-in constant.
if (cimg::type<double>::is_nan(val)) return _cimg_mp_slot_nan;
if (val==(double)(int)val) {
if (val>=0 && val<=10) return (unsigned int)val;
if (val<0 && val>=-5) return (unsigned int)(10 - val);
}
if (val==0.5) return 16;
// Search for constant already requested before (in const cache).
unsigned int ind = ~0U;
if (constcache_size<1024) {View on GitHub (pinned to f788b534b4)