summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lib/pure/base64.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/pure/base64.nim b/lib/pure/base64.nim
index 9495c4d56..40c9af905 100644
--- a/lib/pure/base64.nim
+++ b/lib/pure/base64.nim
@@ -230,11 +230,11 @@ proc decode*(s: string): string =
 
   template inputChar(x: untyped) =
     let x = int decodeTable[ord(s[inputIndex])]
-    inc inputIndex
     if x == invalidChar:
       raise newException(ValueError,
         "Invalid base64 format character `" & s[inputIndex] &
         "` (ord " & $s[inputIndex].ord & ") at location " & $inputIndex & ".")
+    inc inputIndex
 
   template outputChar(x: untyped) =
     result[outputIndex] = char(x and 255)