[seed] Sandbox: handle situation where __script_path__ was not set



commit 1441bf86f7fc02cc7717b88f88ae85ba175eb726
Author: Jonatan Liljedahl <lijon kymatica com>
Date:   Wed Jun 30 10:19:31 2010 +0800

    Sandbox: handle situation where __script_path__ was not set
    
    Fix to previous commit, handling situation where __script_path__ was not set in calling script

 modules/sandbox/seed-sandbox.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
---
diff --git a/modules/sandbox/seed-sandbox.c b/modules/sandbox/seed-sandbox.c
index a1c80a6..ab07c0e 100644
--- a/modules/sandbox/seed-sandbox.c
+++ b/modules/sandbox/seed-sandbox.c
@@ -86,7 +86,13 @@ seed_sandbox_context_add_globals (SeedContext ctx,
 
   SeedObject g = seed_context_get_global_object (c);
   SeedObject global = seed_context_get_global_object (ctx);
-  seed_object_set_property (c, g, "__script_path__", seed_object_get_property (ctx, global, "__script_path__"));
+
+  SeedValue script_path = seed_object_get_property (ctx, global, "__script_path__"); 
+
+  seed_object_set_property (c, g, "__script_path__", 
+     (script_path && seed_value_is_object(ctx, script_path)) ?
+     script_path : seed_make_undefined(ctx)
+  );
     
   return seed_make_null (ctx);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]