From 0637752d920026306fa506c875ec3d3cedf7a9a2 Mon Sep 17 00:00:00 2001 From: Bryan Roe Date: Fri, 15 Mar 2019 12:46:57 -0700 Subject: [PATCH] Fixed, so if geXInfo returns null, it won't throw an exception --- meshcore/agentcore.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/meshcore/agentcore.c b/meshcore/agentcore.c index d6de8d4..46bc797 100644 --- a/meshcore/agentcore.c +++ b/meshcore/agentcore.c @@ -1455,14 +1455,17 @@ duk_ret_t ILibDuktape_MeshAgent_getRemoteDesktop(duk_context *ctx) duk_push_int(ctx, console_uid); if (duk_pcall(ctx, 1) == 0) { - updateXAuth = Duktape_GetStringPropertyValue(ctx, -1, "xauthority", NULL); - updateDisplay = Duktape_GetStringPropertyValue(ctx, -1, "display", NULL); - - if (console_uid != 0 && updateXAuth == NULL) + if (!duk_is_null(ctx, -1)) { - ILibDuktape_MeshAgent_RemoteDesktop_SendError(ptrs, "Xauthority not found! Is your DM configured to use X?"); - duk_pop(ctx); - return(1); + updateXAuth = Duktape_GetStringPropertyValue(ctx, -1, "xauthority", NULL); + updateDisplay = Duktape_GetStringPropertyValue(ctx, -1, "display", NULL); + + if (console_uid != 0 && updateXAuth == NULL) + { + ILibDuktape_MeshAgent_RemoteDesktop_SendError(ptrs, "Xauthority not found! Is your DM configured to use X?"); + duk_pop(ctx); + return(1); + } } } else