3
0
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:
Shivaram Lingamneni 2018-08-27 23:56:28 -04:00 committed by GitHub
commit 831969f1f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -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)
}

View File

@ -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")