Description: Prevent crash on New Profile Creation
 In trying to avoid a crash if the user renamed the very first profile in
 Connection Dialog I handled the case where a value used as a divisor could
 be zero - but did not spot the situation where it would be -1, when
 creating a new profile.  This commit fixes this show stopper bug:
Author: Stephen Lyons <slysven@virginmedia.com>
Bug: https://bugs.launchpad.net/mudlet/+bug/1633786
Applied-Upstream: commit 767dce55a43808cd0b1cb0ab9aa8d638c3e11bb3
Reviewed-by: Craig Small <csmall@debian.org>
Last-Update: 2016-10-18
--- a/src/dlgConnectionProfiles.cpp
+++ b/src/dlgConnectionProfiles.cpp
@@ -339,7 +339,7 @@
     if( pItem )
     {
         QString currentProfileEditName = pItem->text();
-        int row = mProfileList.indexOf( currentProfileEditName );
+        int row = mProfileList.indexOf( currentProfileEditName ); // This returns -1 if currentProfileEditName not present!
         if( ( row >= 0 ) && ( row < mProfileList.size() ) )
         {
             mProfileList[row] = newProfileName;
@@ -402,7 +402,7 @@
         quint8 i3 = (i*hash)%255;
         quint8 i4 = (3*hash)%255;
         quint8 i5 = (hash)%255;
-        quint8 i6 = (hash/(i+1))%255; // Under some corner cases i might be 0
+        quint8 i6 = (hash/(i+2))%255; // Under some corner cases i might be -1 or 0
         shade.setColorAt( 1, QColor(i1, i2, i3,255) );
         shade.setColorAt( 0, QColor(i4, i5, i6,255) );
 
@@ -1072,7 +1072,7 @@
         quint8 i3 = (i*hash)%255;
         quint8 i4 = (3*hash)%255;
         quint8 i5 = (hash)%255;
-        quint8 i6 = (hash/(i+1))%255; // Under some corner cases i might be 0
+        quint8 i6 = (hash/(i+2))%255; // In the other place where this is used i might be -1 or 0
         shade.setColorAt( 1, QColor(i1, i2, i3,255) );
         shade.setColorAt( 0, QColor(i4, i5, i6,255) );
         QPainter pt(&pb);
