From 86087de47134640ceb246e048ed834d8a922195c Mon Sep 17 00:00:00 2001
From: David Goulet <dgoulet@ev0ke.net>
Date: Mon, 6 Feb 2017 18:43:09 -0500
Subject: [PATCH] Handle missing switch case found by GCC

Signed-off-by: David Goulet <dgoulet@ev0ke.net>
---
 src/scrambler-istream.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/scrambler-istream.c b/src/scrambler-istream.c
index 586d4c3..8fa9fe7 100644
--- a/src/scrambler-istream.c
+++ b/src/scrambler-istream.c
@@ -19,6 +19,7 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
+#include <assert.h>
 #include <arpa/inet.h>
 #include <inttypes.h>
 
@@ -138,6 +139,8 @@ scrambler_istream_read_detect(struct scrambler_istream *sstream)
 
   result = scrambler_istream_read_parent(sstream, MAGIC_SIZE, 0);
   if (result <= 0) {
+    /* Make sure we return an error here. */
+    result = -1;
     goto end;
   }
   source = i_stream_get_data(stream->parent, &source_size);
@@ -331,6 +334,9 @@ scrambler_istream_read(struct istream_private *stream)
     return scrambler_istream_read_decrypt(sstream);
   case ISTREAM_MODE_PLAIN:
     return scrambler_istream_read_plain(sstream);
+  case ISTREAM_MODE_DETECT:
+    /* Something went terribly wrong. */
+    assert(0);
   default:
     /* Should not happened in theory! */
     return -1;
-- 
GitLab