[Cuis-dev] [FIX] Empty class categories crash the browser

Gerald Klix cuis.01 at klix.ch
Mon Jul 31 04:45:13 PDT 2023


Hi all, Hi Juan,

During testing I discovered, that I can
define classes with an empty string as class category.

Alas the class browser(s) will crash, when
trying to display that empty category.

Please find attached a fix for that issue.


HTH and Best Regards,

Gerald
-------------- next part --------------
'From Haver 6.0 [latest update: #5965] on 31 July 2023 at 12:46:08 pm'!

!Browser methodsFor: 'system category list' stamp: 'KLG 7/31/2023 12:45:13'!
systemCategoryRoots
	"Answer the roots of the forest of system categories."
	| categories subcategories roots name |
	categories := self systemCategoryList.
	subcategories := Dictionary new.
	categories do: [ :each |
		name := each 
			ifNotEmpty: [ each findTokens: '-' :: first ]
			ifEmpty: [ each ].
		(subcategories at: name ifAbsentPut: [ OrderedCollection new ]) add: each].
	roots := OrderedCollection new.
	categories do: [ :each|
		name := each 
			ifNotEmpty: [ each findTokens: '-' :: first ]
			ifEmpty: [ each ].
		(roots includes: name) ifFalse:
			[(subcategories at: name) size > 1
				ifTrue: [ roots add: name ]
				ifFalse: [ roots add: (subcategories at: name) first ] ] ].
	^ roots collect: [:each |
		SystemCategoryWrapper with: each name: each model: self]! !


!SystemCategoryWrapper methodsFor: 'converting' stamp: 'KLG 7/31/2023 12:43:17'!
asString
	^ itemName 
		ifEmpty: [ '<empty category>' ]
		ifNotEmpty: [ itemName ]! !



More information about the Cuis-dev mailing list