B4J Question Why do I need this line?

Walt

Member
TR.Initialize(File.OpenInput(f,""))
Do While line <> Null
line = TR.ReadLine
If line = Null Then Exit
WriteTextArea
Loop
TR.Close
End Sub

Sub WriteTextArea

It looks totally redundant to me but without it the Do While loop try's to take too many lines and I get this error: java.lang.NullPointerException
 

Walt

Member
Okay, in response to my own question, the do-loop tests at the beginning. By then, it's too late, the null value has already been passed to WriteTextArea and caused the error.
Still, it seems there should be a tidier way to do that.
 
Upvote 0
Top