Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3456 for trunk


Ignore:
Timestamp:
04/21/10 07:17:21 (15 years ago)
Author:
swagner
Message:

Fixed null reference exception in collection views (#973)

Location:
trunk/sources
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemArrayView.cs

    r3455 r3456  
    196196    #region ListView Events
    197197    protected virtual void itemsListView_SelectedIndexChanged(object sender, EventArgs e) {
    198       addButton.Enabled = itemsListView.SelectedItems.Count > 0 && !Content.IsReadOnly && !ReadOnly;
     198      addButton.Enabled = itemsListView.SelectedItems.Count > 0 && (Content != null) && !Content.IsReadOnly && !ReadOnly;
    199199      moveUpButton.Enabled = itemsListView.SelectedItems.Count == 1 &&
    200200                             itemsListView.SelectedIndices[0] != 0 &&
    201                              !Content.IsReadOnly && !ReadOnly;
     201                             (Content != null) && !Content.IsReadOnly && !ReadOnly;
    202202      moveDownButton.Enabled = itemsListView.SelectedItems.Count == 1 &&
    203203                               itemsListView.SelectedIndices[0] != itemsListView.Items.Count - 1 &&
    204                                !Content.IsReadOnly && !ReadOnly;
    205       removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && !Content.IsReadOnly && !ReadOnly;
     204                               (Content != null) && !Content.IsReadOnly && !ReadOnly;
     205      removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && (Content != null) && !Content.IsReadOnly && !ReadOnly;
    206206
    207207      if (itemsListView.SelectedItems.Count == 1) {
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs

    r3455 r3456  
    167167    #region ListView Events
    168168    protected virtual void itemsListView_SelectedIndexChanged(object sender, EventArgs e) {
    169       removeButton.Enabled = !Content.IsReadOnly && !ReadOnly && itemsListView.SelectedItems.Count > 0;
     169      removeButton.Enabled = (Content != null) && !Content.IsReadOnly && !ReadOnly && itemsListView.SelectedItems.Count > 0;
    170170      if (itemsListView.SelectedItems.Count == 1) {
    171171        T item = (T)itemsListView.SelectedItems[0].Tag;
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.cs

    r3455 r3456  
    193193      moveUpButton.Enabled = itemsListView.SelectedItems.Count == 1 &&
    194194                             itemsListView.SelectedIndices[0] != 0 &&
    195                              !Content.IsReadOnly && !ReadOnly;
     195                             (Content != null) && !Content.IsReadOnly && !ReadOnly;
    196196      moveDownButton.Enabled = itemsListView.SelectedItems.Count == 1 &&
    197197                               itemsListView.SelectedIndices[0] != itemsListView.Items.Count - 1 &&
    198                                !Content.IsReadOnly && !ReadOnly;
     198                               (Content != null) && !Content.IsReadOnly && !ReadOnly;
    199199      removeButton.Enabled = itemsListView.SelectedItems.Count > 0 &&
    200                              !Content.IsReadOnly && !ReadOnly;
     200                             (Content != null) && !Content.IsReadOnly && !ReadOnly;
    201201
    202202      if (itemsListView.SelectedItems.Count == 1) {
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs

    r3455 r3456  
    163163    #region ListView Events
    164164    protected virtual void itemsListView_SelectedIndexChanged(object sender, EventArgs e) {
    165       removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && !Content.IsReadOnly && !ReadOnly;
     165      removeButton.Enabled = itemsListView.SelectedItems.Count > 0 && (Content != null) && !Content.IsReadOnly && !ReadOnly;
    166166      if (itemsListView.SelectedItems.Count == 1) {
    167167        IRun item = (IRun)itemsListView.SelectedItems[0].Tag;
Note: See TracChangeset for help on using the changeset viewer.