[Groonga-commit] nroonga/nroonga at c85a9f9 [master] Fix to make one condition with `||`

Back to archive index

abetomo null+****@clear*****
Thu Sep 21 16:27:29 JST 2017


abetomo	2017-09-21 16:27:29 +0900 (Thu, 21 Sep 2017)

  New Revision: c85a9f96a633b82f19f773d384c7d0a1d7db7a74
  https://github.com/nroonga/nroonga/commit/c85a9f96a633b82f19f773d384c7d0a1d7db7a74

  Merged 5a6fc95: Merge pull request #28 from abetomo/fix_to_parse_json_with_addon

  Message:
    Fix to make one condition with `||`

  Modified files:
    src/nroonga.cc

  Modified: src/nroonga.cc (+3 -11)
===================================================================
--- src/nroonga.cc    2017-09-21 15:58:25 +0900 (88d2a3c)
+++ src/nroonga.cc    2017-09-21 16:27:29 +0900 (8ff2e7a)
@@ -123,14 +123,10 @@ void Database::CommandAfter(uv_work_t* req) {
     Nan::TryCatch tc;
     Nan::JSON NanJSON;
     Nan::MaybeLocal<v8::Value> parse_value = NanJSON.Parse(string);
-    if (tc.HasCaught()) {
+    if (tc.HasCaught() || parse_value.IsEmpty()) {
       argv[1] = string;
     } else {
-      if (parse_value.IsEmpty()) {
-        argv[1] = string;
-      } else {
-        argv[1] = parse_value.ToLocalChecked();
-      }
+      argv[1] = parse_value.ToLocalChecked();
     }
   }
   Nan::MakeCallback(Nan::GetCurrentContext()->Global(),
@@ -218,11 +214,7 @@ void Database::CommandSyncString(
   Nan::TryCatch tc;
   Nan::JSON NanJSON;
   Nan::MaybeLocal<v8::Value> parse_value = NanJSON.Parse(string);
-  if (tc.HasCaught()) {
-    info.GetReturnValue().Set(string);
-    return;
-  }
-  if (parse_value.IsEmpty()) {
+  if (tc.HasCaught() || parse_value.IsEmpty()) {
     info.GetReturnValue().Set(string);
     return;
   }
-------------- next part --------------
HTML����������������������������...
URL: https://lists.osdn.me/mailman/archives/groonga-commit/attachments/20170921/c6848932/attachment.htm 



More information about the Groonga-commit mailing list
Back to archive index