mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-04-12 03:57:27 +00:00
fix: check EISC for null prior to using
This commit is contained in:
parent
dba07dced8
commit
078f35a91d
1 changed files with 20 additions and 0 deletions
|
|
@ -37,19 +37,39 @@ namespace PepperDash.Essentials.Core
|
|||
|
||||
public void SendBytes(byte[] bytes)
|
||||
{
|
||||
if (eisc == null)
|
||||
{
|
||||
Debug.Console(0, this, "EISC not linked. Call LinkToApi before sending bytes.");
|
||||
return;
|
||||
}
|
||||
eisc.Eisc.SetString(joinMap.SendText.JoinNumber, Encoding.ASCII.GetString(bytes, 0, bytes.Length));
|
||||
}
|
||||
|
||||
public void SendText(string text)
|
||||
{
|
||||
if (eisc == null)
|
||||
{
|
||||
Debug.Console(0, this, "EISC not linked. Call LinkToApi before sending text.");
|
||||
return;
|
||||
}
|
||||
eisc.Eisc.SetString(joinMap.SendText.JoinNumber, text);
|
||||
}
|
||||
|
||||
public void Connect() {
|
||||
if (eisc == null)
|
||||
{
|
||||
Debug.Console(0, this, "EISC not linked. Call LinkToApi before connecting.");
|
||||
return;
|
||||
}
|
||||
eisc.Eisc.SetBool(joinMap.Connect.JoinNumber, true);
|
||||
}
|
||||
|
||||
public void Disconnect() {
|
||||
if (eisc == null)
|
||||
{
|
||||
Debug.Console(0, this, "EISC not linked. Call LinkToApi before disconnecting.");
|
||||
return;
|
||||
}
|
||||
eisc.Eisc.SetBool(joinMap.Connect.JoinNumber, false);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue