Browse Source

[js] guard CallStack.exceptionStack when called without previous error

frabbit 10 years ago
parent
commit
f518e14616
1 changed files with 1 additions and 0 deletions
  1. 1 0
      std/haxe/CallStack.hx

+ 1 - 0
std/haxe/CallStack.hx

@@ -40,6 +40,7 @@ class CallStack {
 	static var lastException:js.Error;
 
 	static function getStack(e:js.Error):Array<StackItem> {
+		if (e == null) return [];
 		// https://code.google.com/p/v8/wiki/JavaScriptStackTraceApi
 		var oldValue = (untyped Error).prepareStackTrace;
 		(untyped Error).prepareStackTrace = function (error, callsites :Array<Dynamic>) {