Skip to content

Commit abdb5c5

Browse files
authored
Null-Check for GeneratorInstance (#177)
If SEWorldGenerator Plugin is used or Procedural Seed is 0 there will be no GeneratorInstance. In this case this Method will NRE. However we still would like to delete stuff. So just return null. Because when there is no GeneratorInstance we dont have to tell itentities are being deleted. Luckily the IDisposable in the using() block is Nullable :-)
1 parent 3b43962 commit abdb5c5

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎Essentials/Commands/VoxelModule.cs‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,17 @@ private static bool ResetVoxelInArea(Vector3D Center, float Radius)
345345

346346
private static LockToken PinDelete()
347347
{
348+
/*
349+
* If SEWorldGenerator Plugin is used or Procedural Seed is 0 there
350+
* will be no GeneratorInstance. In this case this Method will NRE.
351+
*
352+
* However we still would like to delete stuff. So just return null.
353+
* Because when there is no GeneratorInstance we dont have to tell it
354+
* entities are being deleted.
355+
*/
356+
if (GeneratorInstance == null)
357+
return null;
358+
348359
return new LockToken();
349360
}
350361

0 commit comments

Comments
 (0)