From c84525ddefed71d2ba65571dfa8b614d8af6f5ac Mon Sep 17 00:00:00 2001 From: Jonathan Arndt Date: Wed, 9 Feb 2022 11:39:35 -0800 Subject: [PATCH] Update recent call history and call method to protect for zero value from SIMPL --- .../VideoCodec/CiscoCodec/CiscoSparkCodec.cs | 2 +- .../VideoCodec/VideoCodecBase.cs | 18 ++++++++++++++---- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs index efe1914d..74f4b919 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/CiscoCodec/CiscoSparkCodec.cs @@ -1516,7 +1516,7 @@ namespace PepperDash.Essentials.Devices.Common.VideoCodec.Cisco return; } - SendText(string.Format("xConfiguration Audio SoundsAndAlerts RingVolume: [0]", volume)); + SendText(string.Format("xConfiguration Audio SoundsAndAlerts RingVolume: {0}", volume)); } /// diff --git a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs index fd24c8ec..fcdcc127 100644 --- a/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs +++ b/essentials-framework/Essentials Devices Common/Essentials Devices Common/VideoCodec/VideoCodecBase.cs @@ -982,6 +982,8 @@ ScreenIndexIsPinnedTo: {8} (a{17}) private void SelectDirectoryEntry(IHasDirectory codec, ushort i, BasicTriList trilist, VideoCodecControllerJoinMap joinMap) { + if (i < 1 || i > codec.CurrentDirectoryResult.CurrentDirectoryResults.Count) return; + var entry = codec.CurrentDirectoryResult.CurrentDirectoryResults[i - 1]; if (entry is DirectoryFolder) @@ -1047,10 +1049,12 @@ ScreenIndexIsPinnedTo: {8} (a{17}) const int offset = maxStrings; var stringIndex = 0; var arrayIndex = 0; - var tokenArray = new XSigToken[contact.ContactMethods.Count]; + // Create a new token array and set the size to the number of methods times the total number of signals + var tokenArray = new XSigToken[maxMethods * offset]; + + Debug.Console(2, this, "Creating XSIG token array with size {0}", maxMethods * offset); // TODO: Add code to generate XSig data - foreach (var method in contact.ContactMethods) { if (arrayIndex >= maxMethods * offset) @@ -1606,11 +1610,17 @@ ScreenIndexIsPinnedTo: {8} (a{17}) // Selected item action and feedback trilist.SetUShortSigAction(joinMap.SelectRecentCallItem.JoinNumber, (u) => { + if (u == 0 || u > codec.CallHistory.RecentCalls.Count) + { + Debug.Console(2, this, "Recent Call History index out of range"); + return; + } + _selectedRecentCallItemIndex = (int)(u - 1); - trilist.SetUshort(joinMap.SelectRecentCallItem.JoinNumber, u); + trilist.SetUshort(joinMap.SelectRecentCallItem.JoinNumber, u); var _selectedRecentCallItem = codec.CallHistory.RecentCalls[_selectedRecentCallItemIndex]; - + if (_selectedRecentCallItem != null) { trilist.SetString(joinMap.SelectedRecentCallName.JoinNumber, _selectedRecentCallItem.Name);