Porting: Fix endless loop if image format is not recognized
authorest31 <MTest31@outlook.com>
Wed, 3 Aug 2016 21:20:36 +0000 (23:20 +0200)
committerest31 <MTest31@outlook.com>
Wed, 3 Aug 2016 21:33:04 +0000 (23:33 +0200)
src/porting.cpp

index 15a18bdfbd9746b8c42db31ffa8f3d04d38bb7d2..acd0472329f12d33fe3ea306e8ecb0b4a2e92660 100644 (file)
@@ -619,7 +619,8 @@ bool setXorgWindowIcon(IrrlichtDevice *device,
        video::IVideoDriver *v_driver = device->getVideoDriver();
 
        video::IImageLoader *image_loader = NULL;
-       for (u32 i = v_driver->getImageLoaderCount() - 1; i >= 0; i--) {
+       u32 cnt = v_driver->getImageLoaderCount();
+       for (u32 i = 0; i < cnt; i++) {
                if (v_driver->getImageLoader(i)->isALoadableFileExtension(icon_file.c_str())) {
                        image_loader = v_driver->getImageLoader(i);
                        break;