File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -25,14 +25,14 @@ public static uint CreateInstance(string typeNamespace)
2525
2626 try
2727 {
28- Type type = Assemblies . FindTypeInLoadedAssemblies ( typeNamespace ) ;
28+ Type type = Assemblies . FindTypeInLoadedAssemblies ( typeNamespace ) ! ;
2929 if ( type == null )
3030 {
3131 Console . WriteLine ( $ "[CreateInstance Error] Type '{ typeNamespace } ' not found in loaded assemblies.") ;
3232 return 0 ;
3333 }
3434
35- object instance = Activator . CreateInstance ( type ) ;
35+ object instance = Activator . CreateInstance ( type ) ?? throw new Exception ( "Failed to create instance." ) ;
3636 instanceMap [ id ] = instance ;
3737 return id ;
3838 }
@@ -74,11 +74,11 @@ public static void RunInstanceMethod(uint id, string methodCall)
7474 return ;
7575
7676 // Convert arguments to the correct types
77- object [ ] args = ConvertArguments ( method , argStrings ) ;
77+ object [ ] args = ConvertArguments ( method , argStrings ?? Array . Empty < string > ( ) ) ;
7878 method . Invoke ( instance , args ) ;
7979 }
8080
81- private static string ParseMethodName ( string methodCall , out string [ ] args )
81+ private static string ? ParseMethodName ( string methodCall , out string [ ] ? args )
8282 {
8383 int parenStart = methodCall . IndexOf ( '(' ) ;
8484 int parenEnd = methodCall . LastIndexOf ( ')' ) ;
You can’t perform that action at this time.
0 commit comments