Skip to content

Commit

Permalink
Handle execution in unknown scripts (probably in a bad state)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benjamin-Dobell committed Nov 13, 2019
1 parent ccdab04 commit d023ec2
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/MoonSharp.Interpreter/TtsDebugger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,13 @@ public static void OnStringDone(Script script)

private static string SourceCodeToTempPath(SourceCode sourceCode)
{
var scriptName = scriptNames[sourceCode.OwnerScript];
string scriptName;

if (!scriptNames.TryGetValue(sourceCode.OwnerScript, out scriptName))
{
scriptName = "unknown";
}

var sourceName = (scriptName == sourceCode.Name ? scriptName : $"{scriptName}_{sourceCode.Name}").Replace(Path.DirectorySeparatorChar, '_');

var path = Path.Combine(tempPath, sourceName + ".ttslua");
Expand Down

0 comments on commit d023ec2

Please sign in to comment.