Free cookie consent management tool by TermsFeed Policy Generator

Changeset 5302


Ignore:
Timestamp:
01/16/11 03:14:15 (14 years ago)
Author:
swagner
Message:

Fixed exception which was thrown when item updates are still pending after the content of an ItemCollectionView has already been changed (#1324)

Location:
trunk/sources
Files:
4 edited

Legend:

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

    r5287 r5302  
    2323using System.Collections.Generic;
    2424using System.Drawing;
     25using System.Linq;
    2526using System.Windows.Forms;
    2627using HeuristicLab.Collections;
     
    139140        try {
    140141          return (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
    141         } catch (Exception ex) {
     142        }
     143        catch (Exception ex) {
    142144          ErrorHandling.ShowErrorDialog(this, ex);
    143145        }
     
    213215        return listViewItems;
    214216      } else {
    215         return itemListViewItemMapping[item];
     217        List<ListViewItem> listViewItems = null;
     218        itemListViewItemMapping.TryGetValue(item, out listViewItems);
     219        return listViewItems == null ? Enumerable.Empty<ListViewItem>() : listViewItems;
    216220      }
    217221    }
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemCollectionView.cs

    r5287 r5302  
    128128        try {
    129129          return (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
    130         } catch (Exception ex) {
     130        }
     131        catch (Exception ex) {
    131132          ErrorHandling.ShowErrorDialog(this, ex);
    132133        }
     
    195196        return listViewItems;
    196197      } else {
    197         return itemListViewItemMapping[item];
     198        List<ListViewItem> listViewItems = null;
     199        itemListViewItemMapping.TryGetValue(item, out listViewItems);
     200        return listViewItems == null ? Enumerable.Empty<ListViewItem>() : listViewItems;
    198201      }
    199202    }
  • trunk/sources/HeuristicLab.Core.Views/3.3/ItemListView.cs

    r5287 r5302  
    2323using System.Collections.Generic;
    2424using System.Drawing;
     25using System.Linq;
    2526using System.Windows.Forms;
    2627using HeuristicLab.Collections;
     
    142143        try {
    143144          return (T)typeSelectorDialog.TypeSelector.CreateInstanceOfSelectedType();
    144         } catch (Exception ex) {
     145        }
     146        catch (Exception ex) {
    145147          ErrorHandling.ShowErrorDialog(this, ex);
    146148        }
     
    216218        return listViewItems;
    217219      } else {
    218         return itemListViewItemMapping[item];
     220        List<ListViewItem> listViewItems = null;
     221        itemListViewItemMapping.TryGetValue(item, out listViewItems);
     222        return listViewItems == null ? Enumerable.Empty<ListViewItem>() : listViewItems;
    219223      }
    220224    }
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs

    r5287 r5302  
    216216        return listViewItems;
    217217      } else {
    218         return itemListViewItemMapping[item];
     218        List<ListViewItem> listViewItems = null;
     219        itemListViewItemMapping.TryGetValue(item, out listViewItems);
     220        return listViewItems == null ? Enumerable.Empty<ListViewItem>() : listViewItems;
    219221      }
    220222    }
Note: See TracChangeset for help on using the changeset viewer.