gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-merchant] branch master updated: -fix NPE


From: gnunet
Subject: [taler-merchant] branch master updated: -fix NPE
Date: Wed, 21 Jul 2021 16:53:59 +0200

This is an automated email from the git hooks/post-receive script.

grothoff pushed a commit to branch master
in repository merchant.

The following commit(s) were added to refs/heads/master by this push:
     new 0eee3574 -fix NPE
0eee3574 is described below

commit 0eee3574dcb7bf1971a2e106f666caa41f8589f3
Author: Christian Grothoff <christian@grothoff.org>
AuthorDate: Wed Jul 21 16:53:57 2021 +0200

    -fix NPE
---
 src/backend/taler-merchant-httpd.c                 |  2 ++
 ...-merchant-httpd_private-post-products-ID-lock.c | 28 ++++++++++------------
 2 files changed, 14 insertions(+), 16 deletions(-)

diff --git a/src/backend/taler-merchant-httpd.c 
b/src/backend/taler-merchant-httpd.c
index 58f82f35..277f7480 100644
--- a/src/backend/taler-merchant-httpd.c
+++ b/src/backend/taler-merchant-httpd.c
@@ -928,6 +928,8 @@ TMH_lookup_instance (const char *instance_id)
      to handle that */
   mi = GNUNET_CONTAINER_multihashmap_get (TMH_by_id_map,
                                           &h_instance);
+  if (NULL == mi)
+    return mi;
   age = GNUNET_TIME_absolute_get_duration (mi->staleness);
   if (age.rel_value_us > INSTANCE_STALENESS.rel_value_us)
   {
diff --git a/src/backend/taler-merchant-httpd_private-post-products-ID-lock.c 
b/src/backend/taler-merchant-httpd_private-post-products-ID-lock.c
index 5a27b56f..0fae6023 100644
--- a/src/backend/taler-merchant-httpd_private-post-products-ID-lock.c
+++ b/src/backend/taler-merchant-httpd_private-post-products-ID-lock.c
@@ -27,14 +27,6 @@
 #include <taler/taler_json_lib.h>
 
 
-/**
- * Lock an existing product.
- *
- * @param rh context of the handler
- * @param connection the MHD connection to handle
- * @param[in,out] hc context with further information about the request
- * @return MHD result code
- */
 MHD_RESULT
 TMH_private_post_products_ID_lock (const struct TMH_RequestHandler *rh,
                                    struct MHD_Connection *connection,
@@ -48,11 +40,11 @@ TMH_private_post_products_ID_lock (const struct 
TMH_RequestHandler *rh,
   struct GNUNET_TIME_Relative duration;
   struct GNUNET_JSON_Specification spec[] = {
     GNUNET_JSON_spec_fixed_auto ("lock_uuid",
-                                 &uuid),
-    GNUNET_JSON_spec_uint32 ("quantity",
-                             &quantity),
+                                 &uuid), // FIXME: use string?
     TALER_JSON_spec_relative_time ("duration",
                                    &duration),
+    GNUNET_JSON_spec_uint32 ("quantity",
+                             &quantity),
     GNUNET_JSON_spec_end ()
   };
 
@@ -94,16 +86,20 @@ TMH_private_post_products_ID_lock (const struct 
TMH_RequestHandler *rh,
                                  mi->settings.id,
                                  product_id,
                                  NULL);
+    if (GNUNET_DB_STATUS_HARD_ERROR == qs)
+      return TALER_MHD_reply_with_error (connection,
+                                         MHD_HTTP_INTERNAL_SERVER_ERROR,
+                                         TALER_EC_GENERIC_DB_STORE_FAILED,
+                                         "lookup_product");
     if (GNUNET_DB_STATUS_SUCCESS_NO_RESULTS == qs)
       return TALER_MHD_reply_with_error (connection,
                                          MHD_HTTP_NOT_FOUND,
                                          
TALER_EC_MERCHANT_GENERIC_PRODUCT_UNKNOWN,
                                          product_id);
-    else
-      return TALER_MHD_reply_with_error (connection,
-                                         MHD_HTTP_GONE,
-                                         
TALER_EC_MERCHANT_PRIVATE_POST_PRODUCTS_LOCK_INSUFFICIENT_STOCKS,
-                                         product_id);
+    return TALER_MHD_reply_with_error (connection,
+                                       MHD_HTTP_GONE,
+                                       
TALER_EC_MERCHANT_PRIVATE_POST_PRODUCTS_LOCK_INSUFFICIENT_STOCKS,
+                                       product_id);
   case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
     return TALER_MHD_reply_static (connection,
                                    MHD_HTTP_NO_CONTENT,

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]