diff --git a/src/lodepng.cpp b/src/lodepng.cpp
index b237d5a..ef8c725 100644
--- a/src/lodepng.cpp
+++ b/src/lodepng.cpp
@@ -3535,8 +3535,7 @@ static void filterScanline(unsigned char* out, const unsigned char* scanline, co
   switch(filterType)
   {
     case 0:
-      if(prevline) for(i = 0; i < length; i++) out[i] = scanline[i];
-      else         for(i = 0; i < length; i++) out[i] = scanline[i];
+      for(i = 0; i < length; i++) out[i] = scanline[i];
       break;
     case 1:
       if(prevline)
