style95 commented on code in PR #516:
URL: https://github.com/apache/openwhisk-cli/pull/516#discussion_r951259415


##########
commands/util.go:
##########
@@ -604,16 +604,20 @@ func getChildValueStrings(keyValueArr whisk.KeyValueArr, 
key string, childKey st
        return res
 }
 
-func getValueFromJSONResponse(field string, response map[string]interface{}) 
interface{} {
+func getValueFromJSONResponse(field string, response interface{}) interface{} {
        var res interface{}
 
-       for key, value := range response {
-               if key == field {
-                       res = value
-                       break
+       if result, ok := response.(map[string]interface{}); ok {
+               for key, value := range result {
+                       if key == field {
+                               res = value
+                               break
+                       }
                }
        }
-
+       if result, ok := response.([]interface{}); ok {

Review Comment:
   ok, it seems now I get it.
   
   Previously, it returns `var res interface{}` without any initialization, 
when it failed to find the `field`.
   Is this an empty string in case it could not find anything?
   Isn't it nil?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@openwhisk.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to