diff --git a/core/java/src/net/i2p/data/Base64.java b/core/java/src/net/i2p/data/Base64.java
index 578dadda2526f4d8906efdf99fa5dbac497ee24b..2a30d3631a97bd33618f064ceb5b5c6e423850aa 100644
--- a/core/java/src/net/i2p/data/Base64.java
+++ b/core/java/src/net/i2p/data/Base64.java
@@ -264,6 +264,8 @@ public class Base64 {
 
     private static void decode(InputStream in, OutputStream out) throws IOException {
         byte decoded[] = decode(new String(read(in)));
+        if (decoded == null)
+            throw new IOException("Invalid base 64 string");
         out.write(decoded);
     }