X-Git-Url: https://gitweb.fperrin.net/?a=blobdiff_plain;f=tim%2Fprune%2Fload%2FFileCacher.java;h=63c8b24eacfd5a4d9354e35f48a99f6794d9a8a4;hb=da0b1f449260a0b4a94318006382a9039726ef3e;hp=733754bd83c0d98cdab258020907f89f98017430;hpb=312fec956e43f5d0a38617da5d0add9c62563e2c;p=GpsPrune.git diff --git a/tim/prune/load/FileCacher.java b/tim/prune/load/FileCacher.java index 733754b..63c8b24 100644 --- a/tim/prune/load/FileCacher.java +++ b/tim/prune/load/FileCacher.java @@ -77,7 +77,8 @@ public class FileCacher /** * Get the top section of the file for preview - * @param inSize number of lines to extract + * @param inNumRows number of lines to extract + * @param inMaxWidth max length of Strings (longer ones will be chopped) * @return String array containing non-blank lines from the file */ public String[] getSnippet(int inNumRows, int inMaxWidth) @@ -96,10 +97,15 @@ public class FileCacher { for (int i=0; i inMaxWidth) - result[i] = result[i].trim(); - if (result[i].length() > inMaxWidth) - result[i] = result[i].substring(0, inMaxWidth); + if (result[i] == null) + result[i] = ""; + else + { + if (result[i].length() > inMaxWidth) + result[i] = result[i].trim(); + if (result[i].length() > inMaxWidth) + result[i] = result[i].substring(0, inMaxWidth); + } } } return result;