mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-26 12:42:50 +01:00
re-add nil receiver for ModeSet.HasMode
This commit is contained in:
parent
1fd63672f3
commit
86836905b3
@ -341,6 +341,10 @@ func NewModeSet() *ModeSet {
|
||||
|
||||
// test whether `mode` is set
|
||||
func (set *ModeSet) HasMode(mode Mode) bool {
|
||||
if set == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return utils.BitsetGet(set[:], uint(mode)-minMode)
|
||||
}
|
||||
|
||||
|
@ -78,7 +78,8 @@ func TestSetMode(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestNilReceivers(t *testing.T) {
|
||||
var set ModeSet
|
||||
set := NewModeSet()
|
||||
set = nil
|
||||
|
||||
if set.HasMode(Invisible) {
|
||||
t.Errorf("nil ModeSet should not have any modes")
|
||||
|
Loading…
Reference in New Issue
Block a user