mirror of
https://github.com/ergochat/ergo.git
synced 2024-12-23 03:02:48 +01:00
Merge pull request #292 from slingamn/nilreceivers
re-add nil receiver for ModeSet.HasMode
This commit is contained in:
commit
831969f1f0
@ -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