Skip to content

Trap Handler is Triggered During Normal Application Execution #708

Answered by stnolting
DS-567 asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @DS-567!

I just tested your program and I also get several load access exceptions. I think this is just a coding issue. Your insertion function seems to be accessing an element that is out of bounds.

If have changed this line

    while (tmp < arr[j] && j >= 0) {

to

    while (tmp < arr[j] && j > 0) {

(according to https://en.wikipedia.org/wiki/Insertion_sort). By this, j cannot get negative inside the while-loop and the program happily executes without any exceptions - but I did not check the actual processing result.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@DS-567
Comment options

@stnolting
Comment options

Answer selected by DS-567
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants