mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-22 21:15:09 +00:00
Prevent index out of bound for 0 line ditaa files.
References plantuml/plantuml#530
This commit is contained in:
parent
5ebddab866
commit
b49d7db1e9
@ -477,7 +477,7 @@ public class Run {
|
||||
}
|
||||
final ISourceFileReader sourceFileReader;
|
||||
if (option.getOutputFile() == null) {
|
||||
File outputDir = option.getOutputDir().getAbsoluteFile();
|
||||
File outputDir = option.getOutputDir();
|
||||
if (outputDir != null && outputDir.getPath().endsWith("$")) {
|
||||
final String path = outputDir.getPath();
|
||||
outputDir = new File(path.substring(0, path.length() - 1)).getAbsoluteFile();
|
||||
@ -490,7 +490,6 @@ public class Run {
|
||||
} else {
|
||||
sourceFileReader = new SourceFileReaderHardFile(option.getDefaultDefines(f), f, option.getOutputFile(),
|
||||
option.getConfig(), option.getCharset(), option.getFileFormatOption());
|
||||
System.out.println(option.getOutputFile().getAbsolutePath());
|
||||
}
|
||||
sourceFileReader.setCheckMetadata(option.isCheckMetadata());
|
||||
((SourceFileReaderAbstract) sourceFileReader).setNoerror(option.isNoerror());
|
||||
|
@ -1507,16 +1507,16 @@ public class TextGrid {
|
||||
public boolean initialiseWithLines(ArrayList<StringBuffer> lines, ProcessingOptions options) throws UnsupportedEncodingException {
|
||||
|
||||
//remove blank rows at the bottom
|
||||
boolean done = false;
|
||||
int i;
|
||||
for(i = lines.size() - 1; !done; i--){
|
||||
StringBuffer row = lines.get(i);
|
||||
if(!StringUtils.isBlank(row.toString())) done = true;
|
||||
|
||||
rows = new ArrayList<>();
|
||||
|
||||
for (StringBuffer row:lines) {
|
||||
if(!StringUtils.isBlank(row.toString()))
|
||||
rows.add(row);
|
||||
}
|
||||
rows = new ArrayList<StringBuffer>(lines.subList(0, i + 2));
|
||||
|
||||
if(options != null) fixTabs(options.getTabSize());
|
||||
else fixTabs(options.DEFAULT_TAB_SIZE);
|
||||
else fixTabs(ProcessingOptions.DEFAULT_TAB_SIZE);
|
||||
|
||||
|
||||
// make all lines of equal length
|
||||
|
Loading…
Reference in New Issue
Block a user