Yalantis/uCrop · error · CImgArgumentException
load_dlm(): Specified filename is (null).
Error message
load_dlm(): Specified filename is (null).
What it means
CImg<T>::load_dlm() needs either an open std::FILE* or a non-null filename; both being null throws CImgArgumentException immediately. DLM is the delimiter-separated values loader, and there is nothing to parse without a source.
Source
Thrown at ucrop/src/main/jni/CImg.h:56716
//! Load image from a DLM file \newinstance.
static CImg<T> get_load_dlm(const char *const filename) {
return CImg<T>().load_dlm(filename);
}
//! Load image from a DLM file \overloading.
CImg<T>& load_dlm(std::FILE *const file) {
return _load_dlm(file,0);
}
//! Load image from a DLM file \newinstance.
static CImg<T> get_load_dlm(std::FILE *const file) {
return CImg<T>().load_dlm(file);
}
CImg<T>& _load_dlm(std::FILE *const file, const char *const filename) {
if (!file && !filename)
throw CImgArgumentException(_cimg_instance
"load_dlm(): Specified filename is (null).",
cimg_instance);
std::FILE *const nfile = file?file:cimg::fopen(filename,"r");
CImg<charT> delimiter(256), tmp(256); *delimiter = *tmp = 0;
unsigned int cdx = 0, dx = 0, dy = 0;
int err = 0;
double val;
assign(256,256,1,1,(T)0);
while ((err = std::fscanf(nfile,"%lf%255[^0-9eEinfa.+-]",&val,delimiter._data))>0) {
if (err>0) (*this)(cdx++,dy) = (T)val;
if (cdx>=_width) resize(3*_width/2,_height,1,1,0);
char c = 0;
if (!cimg_sscanf(delimiter,"%255[^\n]%c",tmp._data,&c) || c=='\n') {
dx = std::max(cdx,dx);
if (++dy>=_height) resize(_width,3*_height/2,1,1,0);
cdx = 0;
}View on GitHub (pinned to f788b534b4)
Solutions
- Supply a valid filename or FILE* to load_dlm.
- Guard the call site with a null check on the path.
- If the data is in memory, parse it yourself or convert to a file/stream first.
Example fix
// before img.load_dlm(path, sep); // path==nullptr // after assert(path != nullptr); img.load_dlm(path, sep);
Defensive patterns
Strategy: type-guard
Validate before calling
if (!path) throw std::invalid_argument("load_dlm requires a filename"); Type guard
bool hasDlmSource(std::FILE* f, const char* name){ return f != nullptr || name != nullptr; } Try / catch
try { img.load_dlm(path, delim); } catch (cimg_library::CImgArgumentException& e) { /* null source */ } Prevention
- Null-check configured paths before loader calls
- Fail fast at config load time if the DLM path is unset
When it happens
Trigger: Calling load_dlm(nullptr) or the dispatch overload where both file and filename are NULL, typically from an unset path variable.
Common situations: Forwarding an optional config path that was never configured; calling the static get_load_dlm wrappers indirectly with default null arguments.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- load_dlm(): Invalid DLM file '%s'.
- load(): Specified filename is (null).
- load_ascii(): Specified filename is (null).
- load_bmp(): Specified filename is (null).
- load_jpeg(): Specified filename is (null).
AI-assisted analysis of Yalantis/uCrop@f788b534b4 (2026-09-08).
Data as JSON: /api/errors/81a7e2b4adf581d7.
Report an issue: GitHub.