summaryrefslogtreecommitdiff
path: root/modules/mono/editor/GodotTools
diff options
context:
space:
mode:
authorIgnacio Etcheverry <ignalfonsore@gmail.com>2019-12-19 16:36:49 +0100
committerIgnacio Etcheverry <ignalfonsore@gmail.com>2019-12-19 16:51:32 +0100
commit98dc07f25fbbea480c99d34472872943b1902ba8 (patch)
tree0c14fe531d2f91b4680e384c78845983a7872701 /modules/mono/editor/GodotTools
parent981c6aa102ba50d314a023a96d7affb7081334e5 (diff)
Mono/C#: Fix Variant -> MonoString* when type is Variant:NIL
`Variant::operator String()` returns "Null" if the type is `Variant:NIL`. We must consider that and return a null `MonoString*` instead when marshalling. This was also causing a "Null" error to be displayed when exporting a game because null string members would be set to "Null" during hot-reload.
Diffstat (limited to 'modules/mono/editor/GodotTools')
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs12
1 files changed, 9 insertions, 3 deletions
diff --git a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
index dd1b58b34b..96cafba87f 100644
--- a/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/Export/ExportPlugin.cs
@@ -78,7 +78,13 @@ namespace GodotTools.Export
catch (Exception e)
{
maybeLastExportError = e.Message;
- GD.PushError($"Failed to export project: {e.Message}");
+
+ // 'maybeLastExportError' cannot be null or empty if there was an error, so we
+ // must consider the possibility of exceptions being thrown without a message.
+ if (string.IsNullOrEmpty(maybeLastExportError))
+ maybeLastExportError = $"Exception thrown: {e.GetType().Name}";
+
+ GD.PushError($"Failed to export project: {maybeLastExportError}");
Console.Error.WriteLine(e);
// TODO: Do something on error once _ExportBegin supports failing.
}
@@ -513,7 +519,7 @@ namespace GodotTools.Export
case OS.Platforms.HTML5:
return "wasm-wasm32";
default:
- throw new NotSupportedException();
+ throw new NotSupportedException($"Platform not supported: {platform}");
}
}
@@ -655,7 +661,7 @@ namespace GodotTools.Export
case OS.Platforms.HTML5:
return "wasm";
default:
- throw new NotSupportedException();
+ throw new NotSupportedException($"Platform not supported: {platform}");
}
}