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