Skip to content

Commit 2a713b7

Browse files
committed
fixed bug that exception happens when selection mode is set to none
1 parent d2c1ca8 commit 2a713b7

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

Editor/ReoGridEditor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,7 @@ void cellTypeMenuItem_Click(object sender, EventArgs e)
875875

876876
var menuItem = sender as ToolStripMenuItem;
877877

878-
if (menuItem != null && menuItem.Tag is Type && worksheet != null)
878+
if (menuItem != null && menuItem.Tag is Type && worksheet != null && !worksheet.SelectionRange.IsEmpty)
879879
{
880880
foreach (var cell in worksheet.Ranges[worksheet.SelectionRange].Cells)
881881
{

ReoGrid/Core/Range.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,15 @@ public ReferenceRange this[string address]
110110
/// <returns>Instance of referenced range to worksheet</returns>
111111
public ReferenceRange this[RangePosition range]
112112
{
113-
get { return new ReferenceRange(this.worksheet, this.worksheet.FixRange(range)); }
113+
get
114+
{
115+
if (range.IsEmpty)
116+
{
117+
throw new ArgumentException("range position is empty", nameof(range));
118+
}
119+
120+
return new ReferenceRange(this.worksheet, this.worksheet.FixRange(range));
121+
}
114122
}
115123
}
116124

0 commit comments

Comments
 (0)