mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-01-11 19:44:52 +00:00
fix: check EISC for null prior to using
This commit is contained in:
@@ -37,19 +37,39 @@ namespace PepperDash.Essentials.Core
|
|||||||
|
|
||||||
public void SendBytes(byte[] bytes)
|
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));
|
eisc.Eisc.SetString(joinMap.SendText.JoinNumber, Encoding.ASCII.GetString(bytes, 0, bytes.Length));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendText(string text)
|
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);
|
eisc.Eisc.SetString(joinMap.SendText.JoinNumber, text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Connect() {
|
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);
|
eisc.Eisc.SetBool(joinMap.Connect.JoinNumber, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Disconnect() {
|
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);
|
eisc.Eisc.SetBool(joinMap.Connect.JoinNumber, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user