summaryrefslogtreecommitdiffstatshomepage
path: root/py/mpz.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/mpz.c')
-rw-r--r--py/mpz.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/py/mpz.c b/py/mpz.c
index cceb079cd3..1dd177b8e7 100644
--- a/py/mpz.c
+++ b/py/mpz.c
@@ -1652,7 +1652,10 @@ char *mpz_as_str(const mpz_t *i, mp_uint_t base) {
// assumes enough space as calculated by mp_int_format_size
// returns length of string, not including null byte
mp_uint_t mpz_as_str_inpl(const mpz_t *i, mp_uint_t base, const char *prefix, char base_char, char comma, char *str) {
- if (str == NULL || base < 2 || base > 32) {
+ if (str == NULL) {
+ return 0;
+ }
+ if (base < 2 || base > 32) {
str[0] = 0;
return 0;
}