File tree Expand file tree Collapse file tree
managed/src/SwiftlyS2.Core/Modules/EntitySystem Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -53,21 +53,18 @@ public static CEntityInstance OnEntityCreated( nint entityPtr )
5353
5454 public static CEntityInstance ? GetEntityByAddress ( nint address )
5555 {
56+ if ( address == 0 ) return null ;
57+
5658 lock ( _lock )
5759 {
58- try
59- {
60- return ! _PtrToIndex . TryGetValue ( address , out var value ) ? null : _Entities [ value ] ;
61- }
62- catch
63- {
64- return null ;
65- }
60+ return ! _PtrToIndex . TryGetValue ( address , out var value ) ? null : _Entities [ value ] ;
6661 }
6762 }
6863
6964 public static void OnEntityDeleted ( nint entityPtr )
7065 {
66+ if ( entityPtr == 0 ) return ;
67+
7168 lock ( _lock )
7269 {
7370 try
@@ -103,16 +100,11 @@ public static IEnumerable<CEntityInstance> GetAllEntities()
103100
104101 public static bool IsAddressValid ( nint address )
105102 {
103+ if ( address == 0 ) return false ;
104+
106105 lock ( _lock )
107106 {
108- try
109- {
110- return _PtrToIndex . ContainsKey ( address ) ;
111- }
112- catch
113- {
114- return false ;
115- }
107+ return _PtrToIndex . ContainsKey ( address ) ;
116108 }
117109 }
118110
You can’t perform that action at this time.
0 commit comments