Skip to content

Commit

Permalink
avoid index out of bounds for empty lines
Browse files Browse the repository at this point in the history
  • Loading branch information
j-dimension committed Nov 16, 2023
1 parent b899513 commit 4bbd87c
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -945,7 +945,10 @@ protected void paintComponent(Graphics g) {
String[] lines = content.split("\n");
for (String line : lines) {
String[] words = line.split(" ");
StringBuilder currentLine = new StringBuilder(words[0]);
String initial="";
if(words.length>0)
initial=words[0];
StringBuilder currentLine = new StringBuilder(initial);

for (int i = 1; i < words.length; i++) {
String testLine = currentLine.toString() + " " + words[i];
Expand Down

0 comments on commit 4bbd87c

Please sign in to comment.