[Pharo-project] PluggableListMorphByItem >> getCurrentSelectionIndex access directly a non-initailized instance variable
In pharo 1.2, MorphicToolBuilderTests >> testGetListSelection raise an error. This error is caused by PluggableListMorphByItem >> getCurrentSelectionIndex, which looks like that: getCurrentSelectionIndex "Answer the index of the current selection." | item | getIndexSelector == nil ifTrue: [^ 0]. item := model perform: getIndexSelector. ^ list findFirst: [ :x | x = item]. list is nil when runing the test. I guess that a better way is to use the accessor 'getList'. This method seems to make the correct initializations befor retrning the instance variable 'list'. When replacing by: getCurrentSelectionIndex "Answer the index of the current selection." | item | getIndexSelector == nil ifTrue: [^ 0]. item := model perform: getIndexSelector. ^ self getList findFirst: [ :x | x = item]. The test pass. I opened an issue: http://code.google.com/p/pharo/issues/detail?id=3028
participants (1)
-
Cyrille Delaunay