summaryrefslogtreecommitdiff
path: root/midtrans.c
diff options
context:
space:
mode:
authorꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2022-10-06 21:48:08 +0800
committerꦌꦫꦶꦏ꧀ꦦꦿꦧꦮꦑꦩꦭ꧀ <erik@darapsa.co.id>2022-10-06 21:48:08 +0800
commitb36bcf5e0345b8d3dec427261d10450a4eae0b46 (patch)
tree2ea32def2dd2ec1633cac01915517a72a9c5c7c8 /midtrans.c
parent96b9c07f99afabaa6506547acf7ab04ae78851fd (diff)
custom_fields can be NULL
Diffstat (limited to 'midtrans.c')
-rw-r--r--midtrans.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/midtrans.c b/midtrans.c
index 062d825..2673292 100644
--- a/midtrans.c
+++ b/midtrans.c
@@ -148,7 +148,8 @@ void midtrans_charge(enum midtrans_payment type, void *object,
char *fields = NULL;
static const char *field_tmpl = "\n\t\"%s\": \"%s\",";
const size_t field_static_len = strlen(field_tmpl) - strlen("%s") * 2;
- while (i < 5 && custom_fields[i] && custom_fields[i + 1]) {
+ while (i < 5 && custom_fields && custom_fields[i]
+ && custom_fields[i + 1]) {
size_t field_len = field_static_len + strlen(custom_fields[i])
+ strlen(custom_fields[i + 1]);
char field[field_len + 1];