File tree Expand file tree Collapse file tree 3 files changed +21
-6
lines changed
src/Files.App/Views/LayoutModes Expand file tree Collapse file tree 3 files changed +21
-6
lines changed Original file line number Diff line number Diff line change @@ -180,8 +180,13 @@ protected override void EndRename(TextBox textBox)
180180 textBlock ! . Visibility = Visibility . Visible ;
181181 }
182182
183- textBox ! . LostFocus -= RenameTextBox_LostFocus ;
184- textBox . KeyDown -= RenameTextBox_KeyDown ;
183+ // Unsubscribe from events
184+ if ( textBox is not null )
185+ {
186+ textBox ! . LostFocus -= RenameTextBox_LostFocus ;
187+ textBox . KeyDown -= RenameTextBox_KeyDown ;
188+ }
189+
185190 FileNameTeachingTip . IsOpen = false ;
186191 IsRenamingItem = false ;
187192 }
Original file line number Diff line number Diff line change @@ -311,8 +311,13 @@ protected override void EndRename(TextBox textBox)
311311 textBlock ! . Visibility = Visibility . Visible ;
312312 }
313313
314- textBox ! . LostFocus -= RenameTextBox_LostFocus ;
315- textBox . KeyDown -= RenameTextBox_KeyDown ;
314+ // Unsubscribe from events
315+ if ( textBox is not null )
316+ {
317+ textBox ! . LostFocus -= RenameTextBox_LostFocus ;
318+ textBox . KeyDown -= RenameTextBox_KeyDown ;
319+ }
320+
316321 FileNameTeachingTip . IsOpen = false ;
317322 IsRenamingItem = false ;
318323
Original file line number Diff line number Diff line change @@ -250,8 +250,13 @@ protected override void EndRename(TextBox textBox)
250250 textBlock ! . Visibility = Visibility . Visible ;
251251 }
252252
253- textBox ! . LostFocus -= RenameTextBox_LostFocus ;
254- textBox . KeyDown -= RenameTextBox_KeyDown ;
253+ // Unsubscribe from events
254+ if ( textBox is not null )
255+ {
256+ textBox ! . LostFocus -= RenameTextBox_LostFocus ;
257+ textBox . KeyDown -= RenameTextBox_KeyDown ;
258+ }
259+
255260 FileNameTeachingTip . IsOpen = false ;
256261 IsRenamingItem = false ;
257262
You can’t perform that action at this time.
0 commit comments