diff options
author | Mike Krüger <mkrueger@xamarin.com> | 2011-10-11 18:41:22 +0400 |
---|---|---|
committer | Mike Krüger <mkrueger@xamarin.com> | 2011-10-11 18:53:18 +0400 |
commit | af197dc178240f56852f1e1f935e13187a5f1bb2 (patch) | |
tree | 8e09627f5ecbada9c9b697b8539c0b06ea700663 /main/src/addins/MonoDevelop.HexEditor | |
parent | d73fc81fbe9cd50d32d355618567f974177269eb (diff) |
Fixed 'Bug 1253 - Hex editor crashes MD when deleting everything'.
Diffstat (limited to 'main/src/addins/MonoDevelop.HexEditor')
-rw-r--r-- | main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/HexEditorData.cs | 2 | ||||
-rw-r--r-- | main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/PieceTable.cs | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/HexEditorData.cs b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/HexEditorData.cs index 7193c353d9..6ca29edb51 100644 --- a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/HexEditorData.cs +++ b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/HexEditorData.cs @@ -178,6 +178,8 @@ namespace Mono.MHex.Data OnReplaced (new ReplaceEventArgs (offset, count, null)); if (!isInUndo) EndAtomicUndo (); + if (Length == 0) + Insert (0, new byte[] {0}) } public void UpdateLine (long line) diff --git a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/PieceTable.cs b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/PieceTable.cs index 8c5d7cca77..7926a3639c 100644 --- a/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/PieceTable.cs +++ b/main/src/addins/MonoDevelop.HexEditor/Mono.MHex.Data/PieceTable.cs @@ -272,7 +272,7 @@ namespace Mono.MHex.Data return; } - long endSegmentLength = offset + length - endNode.value.CalcOffset (endNode); + long endSegmentLength = endNode != null ? offset + length - endNode.value.CalcOffset (endNode) : 0; RedBlackTree<TreeNode>.RedBlackTreeIterator iter = new RedBlackTree<TreeNode>.RedBlackTreeIterator (startNode); RedBlackTree<TreeNode>.RedBlackTreeNode node; do { |