- Fixed crash on deleting things

- Fixed crash on pressing ESC when no map is opened
This commit is contained in:
codeimp 2009-04-02 08:18:09 +00:00
parent 8eec3a835e
commit cf7b69c8f6
3 changed files with 10 additions and 8 deletions

View file

@ -584,9 +584,9 @@ namespace CodeImp.DoomBuilder.BuilderModes
public void DeleteItem()
{
// Make list of selected things
ICollection<Thing> selected = General.Map.Map.GetSelectedThings(true);
List<Thing> selected = new List<Thing>(General.Map.Map.GetSelectedThings(true));
if((selected.Count == 0) && (highlighted != null) && !highlighted.IsDisposed) selected.Add(highlighted);
// Anything to do?
if(selected.Count > 0)
{

View file

@ -386,7 +386,8 @@ namespace CodeImp.DoomBuilder.Editing
public void CancelMode()
{
// Let the mode know
mode.OnCancel();
if(mode != null)
mode.OnCancel();
}
/// <summary>
@ -396,7 +397,8 @@ namespace CodeImp.DoomBuilder.Editing
public void AcceptMode()
{
// Let the mode know
mode.OnAccept();
if(mode != null)
mode.OnAccept();
}
#endregion

View file

@ -1029,7 +1029,7 @@ namespace CodeImp.DoomBuilder.Map
{
if(selected)
{
return sel_vertices;
return new List<Vertex>(sel_vertices);
}
else
{
@ -1044,7 +1044,7 @@ namespace CodeImp.DoomBuilder.Map
{
if(selected)
{
return sel_things;
return new List<Thing>(sel_things);
}
else
{
@ -1059,7 +1059,7 @@ namespace CodeImp.DoomBuilder.Map
{
if(selected)
{
return sel_linedefs;
return new List<Linedef>(sel_linedefs);
}
else
{
@ -1074,7 +1074,7 @@ namespace CodeImp.DoomBuilder.Map
{
if(selected)
{
return sel_sectors;
return new List<Sector>(sel_sectors);
}
else
{