Fixing div by zero in network signal animation code of GP1212 displays.
authorStephaneLenclud
Mon, 09 Feb 2015 22:47:13 +0100
changeset 120300f44b7f0cc
parent 119 bf99a9f669d9
child 121 5551b64e1eeb
Fixing div by zero in network signal animation code of GP1212 displays.
Server/MainForm.cs
Server/SharpDisplayManager.csproj
     1.1 --- a/Server/MainForm.cs	Mon Feb 09 20:13:28 2015 +0100
     1.2 +++ b/Server/MainForm.cs	Mon Feb 09 22:47:13 2015 +0100
     1.3 @@ -246,6 +246,11 @@
     1.4  			if (iDisplay.IsOpen() && iNetworkManager.NetworkListManager.IsConnected && iUpdateCountSinceLastNetworkAnimation==0)
     1.5  			{				
     1.6  				int iconCount=iDisplay.IconCount(Display.TMiniDisplayIconType.EMiniDisplayIconNetworkSignal);
     1.7 +				if (iconCount <= 0)
     1.8 +				{
     1.9 +					//Prevents div by zero and other undefined behavior
    1.10 +					return;
    1.11 +				}
    1.12  				iLastNetworkIconIndex++;
    1.13  				iLastNetworkIconIndex = iLastNetworkIconIndex % (iconCount*2);
    1.14  				for (int i=0;i<iconCount;i++)
     2.1 --- a/Server/SharpDisplayManager.csproj	Mon Feb 09 20:13:28 2015 +0100
     2.2 +++ b/Server/SharpDisplayManager.csproj	Mon Feb 09 22:47:13 2015 +0100
     2.3 @@ -31,8 +31,8 @@
     2.4      <CreateWebPageOnPublish>true</CreateWebPageOnPublish>
     2.5      <WebPage>index.htm</WebPage>
     2.6      <OpenBrowserOnPublish>false</OpenBrowserOnPublish>
     2.7 -    <ApplicationRevision>1</ApplicationRevision>
     2.8 -    <ApplicationVersion>0.1.4.%2a</ApplicationVersion>
     2.9 +    <ApplicationRevision>0</ApplicationRevision>
    2.10 +    <ApplicationVersion>0.2.1.%2a</ApplicationVersion>
    2.11      <UseApplicationTrust>false</UseApplicationTrust>
    2.12      <CreateDesktopShortcut>true</CreateDesktopShortcut>
    2.13      <PublishWizardCompleted>true</PublishWizardCompleted>