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*");
  2.  
  3.                
  4.  
  5.                         if( blah > -1){
  6.  
  7.                         game.setText(game.getText().toString().replace("*LIVE*", ""));
  8.  
  9.                         game.setTextColor(Color.GREEN);
  10.  
  11.                         gameInfo.setTextColor(Color.GREEN);
  12.  
  13.                 }
Parsed in 0.033 seconds, using GeSHi 1.0.8.4


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.

http://www.youtube.com/watch?v=QFD1qGxkgpA
User avatar
BGH
Junior Developer
Junior Developer
 
Posts: 23
Joined: Thu Feb 12, 2009 3:51 am
Location: Melbourne, Australia

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 26 guests