Skip to content

Commit

Permalink
Give error if external assembly is valid but doesn't contain type
Browse files Browse the repository at this point in the history
  • Loading branch information
TollyH committed Nov 25, 2023
1 parent 8122821 commit e4252b3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
12 changes: 12 additions & 0 deletions Processor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2889,6 +2889,12 @@ is not (ulong)StatusFlags.Sign and not (ulong)StatusFlags.Overflow)
Strings.Processor_Error_Assembly_Unknown)
};
}
if (openExtAssembly is null)
{
extLoadContext?.Unload();
extLoadContext = null;
throw new InvalidFunctionException(Strings.Processor_Error_Assembly_No_Type);
}
break;
case 0x1: // ASMX_LDA ptr
if (extLoadContext is not null || openExtAssembly is not null)
Expand Down Expand Up @@ -2922,6 +2928,12 @@ is not (ulong)StatusFlags.Sign and not (ulong)StatusFlags.Overflow)
Strings.Processor_Error_Assembly_Unknown)
};
}
if (openExtAssembly is null)
{
extLoadContext?.Unload();
extLoadContext = null;
throw new InvalidFunctionException(Strings.Processor_Error_Assembly_No_Type);
}
break;
case 0x2: // ASMX_LDF adr
if (extLoadContext is null || openExtAssembly is null)
Expand Down
11 changes: 10 additions & 1 deletion Resources/Localization/Strings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions Resources/Localization/Strings.resx
Original file line number Diff line number Diff line change
Expand Up @@ -1067,4 +1067,7 @@ Press ENTER to continue, or type a command ('help' for command list): </value>
<data name="Processor_Error_Function_Not_Open" xml:space="preserve">
<value>Cannot execute instruction if an external function is not loaded</value>
</data>
<data name="Processor_Error_Assembly_No_Type" xml:space="preserve">
<value>The specified external assembly file does not contain a global public static class named 'AssEmblyInterop'</value>
</data>
</root>

0 comments on commit e4252b3

Please sign in to comment.