fix #3757: NPE while downsampling image
fix #3757: NPE while downsampling image

kumy/cgeo,superspindel/cgeo,samueltardieu/cgeo,schwabe/cgeo,xiaoyanit/cgeo,S-Bartfast/cgeo,pstorch/cgeo,pstorch/cgeo,Bananeweizen/cgeo,mucek4/cgeo,xiaoyanit/cgeo,S-Bartfast/cgeo,lewurm/cgeo,KublaikhanGeek/cgeo,mucek4/cgeo,schwabe/cgeo,lewurm/cgeo,samueltardieu/cgeo,matej116/cgeo,rsudev/c-geo-opensource,ThibaultR/cgeo,vishwakulkarni/cgeo,auricgoldfinger/cgeo,kumy/cgeo,yummy222/cgeo,madankb/cgeo,Huertix/cgeo,yummy222/cgeo,matej116/cgeo,cgeo/cgeo,KublaikhanGeek/cgeo,schwabe/cgeo,madankb/cgeo,brok85/cgeo,SammysHP/cgeo,kumy/cgeo,auricgoldfinger/cgeo,rsudev/c-geo-opensource,marco-dev/c-geo-opensource,marco-dev/c-geo-opensource,ThibaultR/cgeo,madankb/cgeo,vishwakulkarni/cgeo,matej116/cgeo,marco-dev/c-geo-opensource,mucek4/cgeo,superspindel/cgeo,tobiasge/cgeo,brok85/cgeo,SammysHP/cgeo,superspindel/cgeo,cgeo/cgeo,cgeo/cgeo,auricgoldfinger/cgeo,tobiasge/cgeo,Bananeweizen/cgeo,SammysHP/cgeo,rsudev/c-geo-opensource,Bananeweizen/cgeo,xiaoyanit/cgeo,yummy222/cgeo,samueltardieu/cgeo,Huertix/cgeo,S-Bartfast/cgeo,KublaikhanGeek/cgeo,Huertix/cgeo,tobiasge/cgeo,schwabe/cgeo,lewurm/cgeo,cgeo/cgeo,ThibaultR/cgeo,pstorch/cgeo,vishwakulkarni/cgeo,brok85/cgeo