Skip to content

Commit d6eee06

Browse files
committed
ets: add duplicate_bag error for update_counter/4
Signed-off-by: Jakub Gonet <jakub.gonet@swmansion.com>
1 parent bca4c4f commit d6eee06

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/libAtomVM/ets.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,10 @@ EtsErrorCode ets_update_counter_maybe_gc(term ref, term key, term operation, ter
544544
if (IS_NULL_PTR(ets_table)) {
545545
return EtsBadAccess;
546546
}
547+
if (UNLIKELY(ets_table->table_type == EtsTableDuplicateBag)) {
548+
SMP_UNLOCK(ets_table);
549+
return EtsBadEntry;
550+
}
547551

548552
// do not use an invalid term as a root
549553
term safe_default_value = term_is_invalid_term(default_value) ? term_nil() : default_value;

0 commit comments

Comments
 (0)