Skip to content

Commit 19b62b1

Browse files
committed
Small bug fixes
- Fixes NRE when closing form before creating UPS object - Clamp NotifyIcon text length to 63 characters or under (should address issue #5)
1 parent 3041e93 commit 19b62b1

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

WinNUT_V2/WinNUT_GUI/WinNUT.vb

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,10 @@ Public Class WinNUT
437437
LogFile.LogTracing("Init Disconnecting Before Close WinNut", LogLvl.LOG_DEBUG, Me)
438438
RemoveHandler Microsoft.Win32.SystemEvents.PowerModeChanged, AddressOf SystemEvents_PowerModeChanged
439439
' UPSDisconnect()
440-
UPS_Device.Disconnect()
440+
If UPS_Device IsNot Nothing Then
441+
UPS_Device.Disconnect()
442+
End If
443+
441444
LogFile.LogTracing("WinNut Is now Closed", LogLvl.LOG_DEBUG, Me)
442445
End
443446
End If
@@ -554,8 +557,8 @@ Public Class WinNUT
554557
FormText &= WinNUT_Globals.StrLog.Item(AppResxStr.STR_MAIN_BATOK)
555558
End Select
556559
End Select
557-
If NotifyStr.Length > 64 Then
558-
NotifyStr = NotifyStr.Substring(0, (64 - NotifyStr.Length - 4)) & "..."
560+
If NotifyStr.Length > 63 Then
561+
NotifyStr = NotifyStr.Substring(0, 60) & "..."
559562
End If
560563
NotifyIcon.Text = NotifyStr
561564
If Me.WindowState = System.Windows.Forms.FormWindowState.Minimized And NotifyIcon.Visible = False Then

0 commit comments

Comments
 (0)