Prevent a 0-modulus

If given range for a random is [0, 0), return 0.
Modulus 0 is undefined behaviour.
diff --git a/library/platform_util.c b/library/platform_util.c
index 6ba4112..9461a9c 100644
--- a/library/platform_util.c
+++ b/library/platform_util.c
@@ -150,7 +150,17 @@
 
     mbedtls_hardware_poll( NULL, (unsigned char *) &result, sizeof( result ),
                            &olen );
-    return( result % num );
+
+    if( num == 0 )
+    {
+        result = 0;
+    }
+    else
+    {
+        result %= num;
+    }
+
+    return( result );
 #endif
 }