mirror of
https://github.com/goatcorp/Dalamud.git
synced 2025-12-12 18:27:23 +01:00
Prevent Services from being set twice
This commit is contained in:
parent
797bcade90
commit
9f863a4dbb
1 changed files with 3 additions and 0 deletions
|
|
@ -42,6 +42,9 @@ namespace Dalamud
|
|||
/// <returns>The set object.</returns>
|
||||
public static T Set()
|
||||
{
|
||||
if (instance != null)
|
||||
throw new Exception($"Service {typeof(T).FullName} was set twice");
|
||||
|
||||
var obj = (T?)Activator.CreateInstance(typeof(T), true);
|
||||
|
||||
SetInstanceObject(obj);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue