Jump to content

Recommended Posts

Posted

So, I am using Vazkii's Lexica Botania code (with his permission).

 

The bookmark feature for some reason crashes when you remove a bookmark, and I cannot figure out why. For some reason it is trying to remove -1 from an array list even when it shouldn't be told to.

 

Here is the GUI code (modified version of vazkii's, slightly messy ATM)

 

  Reveal hidden contents

 

 

And the crash...

 

  Reveal hidden contents

 

while(awake)

{

    coffee++;

}

Posted

ArrayList#indexOf

will return -1 if the list doesn't contain the element. Calling

ArrayList#remove

with -1 will throw an exception (as you've seen).

 

You need to figure out why

bookmarkKeys

doesn't contain the return value of

getNotesKey()

or at least correctly handle the list not containing the element.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
  On 11/29/2015 at 1:11 AM, Choonster said:

ArrayList#indexOf

will return -1 if the list doesn't contain the element. Calling

ArrayList#remove

with -1 will throw an exception (as you've seen).

 

You need to figure out why

bookmarkKeys

doesn't contain the return value of

getNotesKey()

or at least correctly handle the list not containing the element.

 

I have absolutely no idea why the arraylist is not containing the return for getNotesKey()... I can't find it :L

while(awake)

{

    coffee++;

}

Posted

Debug it. Take a look at where the content should have been added and find out why it isn't being added. This method is slow, but it alwayes works in the end.  :P

I might be terribly wrong.. Like really, really wrong. But I'm just trying to help.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.