summaryrefslogtreecommitdiff
path: root/plugins/AdvaImg/src/FreeImage/PluginHDR.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/AdvaImg/src/FreeImage/PluginHDR.cpp')
-rw-r--r--plugins/AdvaImg/src/FreeImage/PluginHDR.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/plugins/AdvaImg/src/FreeImage/PluginHDR.cpp b/plugins/AdvaImg/src/FreeImage/PluginHDR.cpp
index 0cde6139db..28ce1a5768 100644
--- a/plugins/AdvaImg/src/FreeImage/PluginHDR.cpp
+++ b/plugins/AdvaImg/src/FreeImage/PluginHDR.cpp
@@ -459,8 +459,9 @@ rgbe_WriteBytes_RLE(FreeImageIO *io, fi_handle handle, BYTE *data, int numbytes)
beg_run += run_count;
old_run_count = run_count;
run_count = 1;
- while((data[beg_run] == data[beg_run + run_count]) && (beg_run + run_count < numbytes) && (run_count < 127))
+ while((beg_run + run_count < numbytes) && (run_count < 127) && (data[beg_run] == data[beg_run + run_count])) {
run_count++;
+ }
}
// if data before next big run is a short run then write it as such
if ((old_run_count > 1)&&(old_run_count == beg_run - cur)) {