Fix crash when moving panels (#52366)

Max Brunsfeld and Mikayla Maki created

Fixes a crash introduced by removing some defensive code in
https://github.com/zed-industries/zed/pull/52276

Release Notes:

- N/A

Co-authored-by: Mikayla Maki <mikayla.c.maki@gmail.com>

Change summary

crates/workspace/src/dock.rs | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

Detailed changes

crates/workspace/src/dock.rs 🔗

@@ -541,7 +541,10 @@ impl Dock {
                         PanelSizeState::default()
                     };
 
-                    this.remove_panel(&panel, window, cx);
+                    if !this.remove_panel(&panel, window, cx) {
+                        // Panel was already moved from this dock
+                        return;
+                    }
 
                     new_dock.update(cx, |new_dock, cx| {
                         let index =