From 54b533eacf01b45663e7858e44cfe8e2ea248564 Mon Sep 17 00:00:00 2001 From: Kumar Devvrat Date: Sat, 10 Jul 2010 11:38:03 +0000 Subject: [PATCH] Add possible null checks git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/wpfdesigner@6085 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61 --- .../WpfDesign.Designer/Project/DesignSurface.xaml.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml.cs b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml.cs index 50162f9da3..85a9fec37a 100644 --- a/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml.cs +++ b/src/AddIns/DisplayBindings/WpfDesign/WpfDesign.Designer/Project/DesignSurface.xaml.cs @@ -126,8 +126,6 @@ namespace ICSharpCode.WpfDesign.Designer /// public void UnloadDesigner() { - if(_focusNav!=null) - _focusNav.End(); if (_designContext != null) { foreach (object o in _designContext.Services.AllServices) { IDisposable d = o as IDisposable; @@ -175,10 +173,12 @@ namespace ICSharpCode.WpfDesign.Designer public bool CanCopyOrCut() { ISelectionService selectionService = GetService(); + if(selectionService!=null){ if (selectionService.SelectedItems.Count == 0) return false; if (selectionService.SelectedItems.Count == 1 && selectionService.PrimarySelection == DesignContext.RootItem) return false; + } return true; } @@ -218,7 +218,7 @@ namespace ICSharpCode.WpfDesign.Designer public bool CanPaste() { ISelectionService selection = _designContext.Services.Selection; - if(selection.SelectedItems.Count!=0){ + if(selection!=null && selection.SelectedItems.Count!=0){ string xaml = Clipboard.GetText(TextDataFormat.Xaml); if(xaml != "" && xaml != " ") return true;