Skip to content

Commit

Permalink
[TIMOB-25192] Evaluating a null value in async crashes app (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
infosia committed Sep 15, 2017
1 parent 0d88fc5 commit 90eec54
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions windows/src/Hyperloop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ JSValue HyperloopPromiseCallback::CallAsFunction(const std::vector<JSValue>& js_
try {
const auto result = AsyncSupport::GetResults(generic_type__, native_object__);
const auto ctx = resolve.get_context();
const auto object = HyperloopModule::Convert(ctx, ref new HyperloopInvocation::Instance(result->GetType(), result));
const auto object = result == nullptr ? ctx.CreateNull() : HyperloopModule::Convert(ctx, ref new HyperloopInvocation::Instance(result->GetType(), result));
const std::vector<JSValue> args = { object };
static_cast<JSObject>(resolve)(args, resolve.get_context().get_global_object());
} catch (Platform::COMException^ e) {
Expand All @@ -170,7 +170,7 @@ JSValue HyperloopPromiseCallback::CallAsFunction(const std::vector<JSValue>& js_
try {
const auto result = AsyncSupport::GetResults(generic_type__, native_object__);
const auto ctx = resolve.get_context();
const auto object = HyperloopModule::Convert(ctx, ref new HyperloopInvocation::Instance(result->GetType(), result));
const auto object = result == nullptr ? ctx.CreateNull() : HyperloopModule::Convert(ctx, ref new HyperloopInvocation::Instance(result->GetType(), result));
const std::vector<JSValue> args = { object };
static_cast<JSObject>(resolve)(args, resolve.get_context().get_global_object());
} catch (Platform::COMException^ e) {
Expand All @@ -193,7 +193,7 @@ JSValue HyperloopPromiseCallback::CallAsFunction(const std::vector<JSValue>& js_
try {
const auto result = AsyncSupport::GetResults(generic_type__, native_object__);
const auto ctx = resolve.get_context();
const auto object = HyperloopModule::Convert(ctx, ref new HyperloopInvocation::Instance(result->GetType(), result));
const auto object = result == nullptr ? ctx.CreateNull() : HyperloopModule::Convert(ctx, ref new HyperloopInvocation::Instance(result->GetType(), result));
const std::vector<JSValue> args = { object };
static_cast<JSObject>(resolve)(args, resolve.get_context().get_global_object());
} catch (Platform::COMException^ e) {
Expand Down

0 comments on commit 90eec54

Please sign in to comment.