entech281 / Season_2018

0 stars 1 forks source link

Code Crash #55

Open mandrews281 opened 6 years ago

mandrews281 commented 6 years ago

Our current code crashes if the field message is empty. This happens when we don't set the message on the drivestation, but it also happens when the robot is disabled (so the dashboard gets updated). The origin of the problem is line 130 in Robot.java String gameMessage = DriverStation.getInstance().getGameSpecificMessage(); I don't know if gameMessage gets returned as null or a zero lengthed string. But FieldMessageGetter.convertGameMessageToFieldMessage(String gameMessage) Assumes the gameMessage is 3 characters long, so both a null or a zero lengthed string will cause it to crash.

I don't know what will happened on the field, but I don't want our code crashing while we are waiting for a match to start. I also don't know what would happened to our code if we pass in a dummy string of say 3 spaces.

dcowden commented 6 years ago

@Aryan sounds like a great opportunity for some junit tests!

mandrews281 commented 6 years ago

And some working code :-)

mandrews281 commented 6 years ago

My scan of FieldMessageGetter is that 3 blanks is equivalent to "RRR"since our if statements are all basically : if ( char == "L") { setLeft() } else { setRight() }