sourcegit-scm / sourcegit

Windows/macOS/Linux GUI client for GIT users
MIT License
664 stars 69 forks source link

[Bug] When the remote branch is deleted, deleting the local branch will throw NRE #238

Closed gadfly3173 closed 2 weeks ago

gadfly3173 commented 2 weeks ago

https://github.com/sourcegit-scm/sourcegit/blob/15e7df60859f9d9169afd450956ce35454b24f83/src/ViewModels/DeleteBranch.cs#L38

TrackingRemoteBranch could be null.

Crash::: System.NullReferenceException: Object reference not set to an instance of an object.

----------------------------
Version: 8.19.0.0
OS: Unix 5.15.77.64
Framework: .NETCoreApp,Version=v8.0
Source: SourceGit
---------------------------

   at SourceGit.ViewModels.DeleteBranch..ctor(Repository repo, Branch branch) in /home/homolo/Documents/sourcegit/src/ViewModels/DeleteBranch.cs:line 39
   at SourceGit.ViewModels.Repository.<>c__DisplayClass125_0.<CreateContextMenuForLocalBranch>b__2(Object o, RoutedEventArgs e) in /home/homolo/Documents/sourcegit/src/ViewModels/Repository.cs:line 1357
   at Avalonia.Interactivity.Interactive.<AddHandler>g__InvokeAdapter|4_0[TEventArgs](Delegate baseHandler, Object sender, RoutedEventArgs args)
   at Avalonia.Interactivity.Interactive.<>c__4`1.<AddHandler>b__4_1(Delegate baseHandler, Object sender, RoutedEventArgs args)
   at Avalonia.Interactivity.EventRoute.RaiseEventImpl(RoutedEventArgs e)
   at Avalonia.Interactivity.EventRoute.RaiseEvent(Interactive source, RoutedEventArgs e)
   at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e)
   at Avalonia.Controls.MenuItem.Avalonia.Controls.IMenuItem.RaiseClick()
   at Avalonia.Controls.Platform.DefaultMenuInteractionHandler.Click(IMenuItem item)
   at Avalonia.Controls.Platform.DefaultMenuInteractionHandler.PointerReleased(Object sender, PointerReleasedEventArgs e)
   at Avalonia.Interactivity.Interactive.<AddHandler>g__InvokeAdapter|4_0[TEventArgs](Delegate baseHandler, Object sender, RoutedEventArgs args)
   at Avalonia.Interactivity.Interactive.<>c__4`1.<AddHandler>b__4_1(Delegate baseHandler, Object sender, RoutedEventArgs args)
   at Avalonia.Interactivity.EventRoute.RaiseEventImpl(RoutedEventArgs e)
   at Avalonia.Interactivity.EventRoute.RaiseEvent(Interactive source, RoutedEventArgs e)
   at Avalonia.Interactivity.Interactive.RaiseEvent(RoutedEventArgs e)
   at Avalonia.Input.MouseDevice.MouseUp(IMouseDevice device, UInt64 timestamp, IInputRoot root, Point p, PointerPointProperties props, KeyModifiers inputModifiers, IInputElement hitTest)
   at Avalonia.Input.MouseDevice.ProcessRawEvent(RawPointerEventArgs e)
   at Avalonia.Input.MouseDevice.ProcessRawEvent(RawInputEventArgs e)
   at Avalonia.Input.InputManager.ProcessInput(RawInputEventArgs e)
   at Avalonia.Controls.TopLevel.HandleInput(RawInputEventArgs e)
   at Avalonia.X11.X11Window.DispatchInput(RawInputEventArgs args)
   at Avalonia.RawEventGrouper.Dispatch(RawInputEventArgs ev)
   at Avalonia.ManualRawEventGrouperDispatchQueue.DispatchNext()
   at Avalonia.X11.X11PlatformThreading.RunLoop(CancellationToken cancellationToken)
   at Avalonia.Threading.DispatcherFrame.Run(IControlledDispatcherImpl impl)
   at Avalonia.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at Avalonia.Threading.Dispatcher.MainLoop(CancellationToken cancellationToken)
   at Avalonia.Controls.ApplicationLifetimes.ClassicDesktopStyleApplicationLifetime.Start(String[] args)
   at Avalonia.ClassicDesktopStyleApplicationLifetimeExtensions.StartWithClassicDesktopLifetime(AppBuilder builder, String[] args, Action`1 lifetimeBuilder)
   at SourceGit.App.Main(String[] args) in /home/homolo/Documents/sourcegit/src/App.axaml.cs:line 52