File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed
Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,9 @@ static int mask(final MaskedFlag... flags) {
4242
4343 int result = 0 ;
4444 for (MaskedFlag flag : flags ) {
45+ if (flag == null ) {
46+ continue ;
47+ }
4548 result |= flag .getMask ();
4649 }
4750 return result ;
Original file line number Diff line number Diff line change 1717
1818import static org .hamcrest .CoreMatchers .is ;
1919import static org .hamcrest .MatcherAssert .assertThat ;
20+ import static org .hamcrest .Matchers .arrayWithSize ;
2021import org .junit .Test ;
2122import static org .lmdbjava .EnvFlags .MDB_FIXEDMAP ;
2223import static org .lmdbjava .EnvFlags .MDB_NOSYNC ;
@@ -54,6 +55,10 @@ public void masking() {
5455 final EnvFlags [] emptyFlags = new EnvFlags []{};
5556 assertThat (mask (emptyFlags ), is (0 ));
5657
58+ final EnvFlags [] nullElementZero = new EnvFlags []{null };
59+ assertThat (nullElementZero , is (arrayWithSize (1 )));
60+ assertThat (mask (nullElementZero ), is (0 ));
61+
5762 assertThat (mask (MDB_NOSYNC ), is (MDB_NOSYNC .getMask ()));
5863
5964 final int expected = MDB_NOSYNC .getMask () + MDB_FIXEDMAP .getMask ();
You can’t perform that action at this time.
0 commit comments