Trap error function stop when index reach 0

Hello.
I am testing a trap function which print the error , which line , and where.
I am using a piece of code found here :
call stack in trap
I made a program (program 1) to test the code.
But the program stop at line 114 when

((--i))

reach 0

The output is :

triger an error -->
ls: cannot access '': No such file or directory
  Function call stack ( command.function() ) ...

program 1 : program 1

Knowing the index value at startup, I made a modified program that mimic program 1
The output is :

triger an error -->
ls: cannot access '': No such file or directory
i : 3
  Function call stack ( command.function() ) ...
    /home/user_install_vb/test_004-d.sh.main()
      /home/user_install_vb/test_004-d.sh._READ_NEW_USER_CONFIG_FILES_()
        /home/user_install_vb/test_004-d.sh.callStack()

program 2 : program 2

Why the program stops when the index reach 0 ?

Any comment is welcome.

Because the status of (( 0 )) is non-zero and you told shell to immediately exit in this case. I presume, bash cannot recursively call ERR function if error happened inside this function.

Thank you very much.
But I have another problem with another arithmetic calculation in the same program with the same trap function.
I call a function ‘foo’ from a find search .
A global variable count files and is initialized to 0 at beginning of the main program.
The function foo increment the number of passed files just before returning.
Incrementing the counter ‘(( COUNT++ ))’ trigger the trap error.

   foo() {
        PARAM="$1"
        printf "FILE : %s\n" "$PARAM"
        printf " -2A- COUNT : %s\n" "$COUNT"
        LIST="$LIST  $PARAM"
        printf " -2B- LIST : %s\n" "$LIST"
        (( COUNT++ ))
    }

Here is the output :

FILE : /tmp/000_UPGRADE_USER/USER_USER/.profile
 -2A- COUNT : 0
 -2B- LIST :   /tmp/000_UPGRADE_USER/USER_USER/.profile
 at: foo(), /run/media/user_install_vb/MY_MINI_MINI_INS/001_SCRIPTS/SCRIPT_UPGRADE_NEW_CONFIG_USER/script_upgrade_new_config_user, line 240
  at: _READ_NEW_USER_CONFIG_FILES_(), /run/media/user_install_vb/MY_MINI_MINI_INS/001_SCRIPTS/000_MY_FUNCTIONS/my_functions.sh, line 278
   at: main(), /run/media/user_install_vb/MY_MINI_MINI_INS/001_SCRIPTS/000_MY_FUNCTIONS/my_functions.sh, line 751

But when the function ‘callStack’ is run, the index is initialized to a value (here “3”).
The first decrement line 107 (–i)) give ((2)) which is non-zero also.
What is the difference