{"record":{"id":"b2c9b4c6ee19a73a","repo":"Yalantis/uCrop","slug":"cimgdisplay-render-empty-specified-image","errorCode":null,"errorMessage":"CImgDisplay::render(): Empty specified image.","messagePattern":"CImgDisplay::render\\(\\): Empty specified image\\.","errorType":"exception","errorClass":"CImgArgumentException","httpStatus":null,"severity":"error","filePath":"ucrop/src/main/jni/CImg.h","lineNumber":10872,"sourceCode":"                                    \"display(): Empty specified image.\",\n                                    cimgdisplay_instance);\n      if (is_empty()) return assign(img);\n      return render(img).paint(false);\n    }\n\n    CImgDisplay& paint(const bool wait_expose=true) {\n      if (is_empty()) return *this;\n      cimg::X11_attr &X11_attr = cimg::X11_attr::ref();\n      X11_attr.lock();\n      _paint(wait_expose);\n      X11_attr.unlock();\n      return *this;\n    }\n\n    template<typename T>\n    CImgDisplay& render(const CImg<T>& img, const bool flag8=false) {\n      if (!img)\n        throw CImgArgumentException(_cimgdisplay_instance\n                                    \"render(): Empty specified image.\",\n                                    cimgdisplay_instance);\n      if (is_empty()) return *this;\n      if (img._depth!=1) return render(img.get_projections2d((img._width - 1)/2,(img._height - 1)/2,\n                                                             (img._depth - 1)/2));\n\n      cimg::X11_attr &X11_attr = cimg::X11_attr::ref();\n      if (X11_attr.nb_bits==8 && (img._width!=_width || img._height!=_height))\n        return render(img.get_resize(_width,_height,1,-100,1));\n      if (X11_attr.nb_bits==8 && !flag8 && img._spectrum==3) {\n        static const CImg<typename CImg<T>::ucharT> default_colormap = CImg<typename CImg<T>::ucharT>::default_LUT256();\n        return render(img.get_index(default_colormap,1,false));\n      }\n\n      const T\n        *data1 = img._data,\n        *data2 = (img._spectrum>1)?img.data(0,0,0,1):data1,\n        *data3 = (img._spectrum>2)?img.data(0,0,0,2):data1;","sourceCodeStart":10854,"sourceCodeEnd":10890,"githubUrl":"https://github.com/Yalantis/uCrop/blob/f788b534b48c144edf786c8cddbf0e029e637804/ucrop/src/main/jni/CImg.h#L10854-L10890","documentation":"Thrown by CImgDisplay::render() when the image to be rendered into the display's frame buffer is empty (no pixel data). The library deliberately rejects empty images rather than painting nothing, since rendering an empty buffer leaves the window in an undefined visual state. Ensure the image was successfully loaded or assigned before rendering.","triggerScenarios":"Thrown at ucrop/src/main/jni/CImg.h:10872 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the image is initialized and has non-zero width/height before calling render()","Test with img.is_empty() and skip or fill the image first if it is empty"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f788b534b48c144edf786c8cddbf0e029e637804","analyzedAt":"2026-09-08T08:36:04.887Z","contentChangedAt":"2026-09-08T08:36:04.887Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}