summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
Diffstat (limited to 'player')
-rw-r--r--player/javascript.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/player/javascript.c b/player/javascript.c
index b00e4eda64..abb1581f86 100644
--- a/player/javascript.c
+++ b/player/javascript.c
@@ -981,7 +981,12 @@ static void script_write_file(js_State *J, void *af)
// args: env var name
static void script_getenv(js_State *J)
{
- js_pushstring(J, getenv(js_tostring(J, 1)));
+ const char *v = getenv(js_tostring(J, 1));
+ if (v) {
+ js_pushstring(J, v);
+ } else {
+ js_pushundefined(J);
+ }
}
// args: as-filename, content-string, returns the compiled result as a function