Weird compiler bug. WTF is going on? With video.

Put your problem here if it does not fit any of the other categories.

Weird compiler bug. WTF is going on? With video.

Postby BGH » Sat Apr 25, 2009 7:19 am

Ok so I have a crazy bug going on.

I tried to take a short video. Unfortunately youtube sped it up heaps so you might have to watch it a few times.

this is the code

Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. int blah =      game.getText().toString().indexOf("*LIVE*");
  5.                         if( blah > -1){
  7.                         game.setText(game.getText().toString().replace("*LIVE*", ""));
  9.                         game.setTextColor(Color.GREEN);
  11.                         gameInfo.setTextColor(Color.GREEN);
  13.                 }
Parsed in 0.012 seconds, using GeSHi

The contents of the IF statement are getting executed whether the condition is met or not. In the movie I step through three iterations. Keep an I on the variable "blah". In the first iteration it is -1, in the second it is 22 and in the third it is -1 again. As you can see the last line of code in the IF statement is still getting executed when blah = -1.

Any explanations? It's so frustrating as this is the final bug before I can get this version of my app out the door.
User avatar
Junior Developer
Junior Developer
Posts: 23
Joined: Thu Feb 12, 2009 3:51 am
Location: Melbourne, Australia


Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 8 guests