mirror of
https://github.com/PepperDash/Essentials.git
synced 2026-02-16 13:15:03 +00:00
Adds try/catch to Communication_BytesReceived callback to prevent exception from getting logged when malformed message is received
This commit is contained in:
@@ -166,6 +166,8 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="sender"></param>
|
/// <param name="sender"></param>
|
||||||
void Communication_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs e)
|
void Communication_BytesReceived(object sender, GenericCommMethodReceiveBytesArgs e)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
// This is probably not thread-safe buffering
|
// This is probably not thread-safe buffering
|
||||||
// Append the incoming bytes with whatever is in the buffer
|
// Append the incoming bytes with whatever is in the buffer
|
||||||
@@ -246,6 +248,11 @@ namespace PepperDash.Essentials.Devices.Displays
|
|||||||
// Save whatever partial message is here
|
// Save whatever partial message is here
|
||||||
IncomingBuffer = newBytes;
|
IncomingBuffer = newBytes;
|
||||||
}
|
}
|
||||||
|
catch (Exception err)
|
||||||
|
{
|
||||||
|
Debug.Console(2, this, "Error parsing feedback: {0}", err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
|
|||||||
Reference in New Issue
Block a user