Fix NPE
This commit is contained in:
parent
e68fbafde9
commit
3ff98a01d2
@ -4,7 +4,6 @@
|
||||
package net.sf.openrocket.gui.print;
|
||||
|
||||
import java.awt.Graphics2D;
|
||||
import java.io.IOException;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.List;
|
||||
|
||||
@ -31,12 +30,13 @@ import net.sf.openrocket.unit.UnitGroup;
|
||||
import net.sf.openrocket.util.Chars;
|
||||
import net.sf.openrocket.util.Coordinate;
|
||||
|
||||
import org.uispec4j.utils.Utils;
|
||||
|
||||
import com.itextpdf.text.Document;
|
||||
import com.itextpdf.text.DocumentException;
|
||||
import com.itextpdf.text.Element;
|
||||
import com.itextpdf.text.Paragraph;
|
||||
import com.itextpdf.text.Rectangle;
|
||||
import com.itextpdf.text.pdf.BaseFont;
|
||||
import com.itextpdf.text.pdf.DefaultFontMapper;
|
||||
import com.itextpdf.text.pdf.PdfContentByte;
|
||||
import com.itextpdf.text.pdf.PdfPCell;
|
||||
@ -277,12 +277,12 @@ public class DesignReport {
|
||||
|
||||
final DefaultFontMapper mapper = new DefaultFontMapper();
|
||||
Graphics2D g2d = theCanvas.createGraphics(thePageImageableWidth, thePageImageableHeight * 2, mapper);
|
||||
final double halfFigureHeight = SCALE_FUDGE_FACTOR * theFigure.getFigureHeightPx()/2;
|
||||
final double halfFigureHeight = SCALE_FUDGE_FACTOR * theFigure.getFigureHeightPx() / 2;
|
||||
int y = PrintUnit.POINTS_PER_INCH;
|
||||
//If the y dimension is negative, then it will potentially be drawn off the top of the page. Move the origin
|
||||
//to allow for this.
|
||||
if (theFigure.getDimensions().getY() < 0.0d) {
|
||||
y += (int)halfFigureHeight;
|
||||
y += (int) halfFigureHeight;
|
||||
}
|
||||
g2d.translate(20, y);
|
||||
|
||||
@ -468,8 +468,8 @@ public class DesignReport {
|
||||
labelTable.addCell(ITextHelper.createCell(MAX_VELOCITY, 2, 2));
|
||||
labelTable.addCell(ITextHelper.createCell(velocityUnit.toStringUnit(flight.getMaxVelocity()), 2, 2));
|
||||
|
||||
labelTable.addCell(ITextHelper.createCell(DEPLOYMENT_VELOCITY, 2,2));
|
||||
labelTable.addCell(ITextHelper.createCell(velocityUnit.toStringUnit(flight.getDeploymentVelocity()),2,2));
|
||||
labelTable.addCell(ITextHelper.createCell(DEPLOYMENT_VELOCITY, 2, 2));
|
||||
labelTable.addCell(ITextHelper.createCell(velocityUnit.toStringUnit(flight.getDeploymentVelocity()), 2, 2));
|
||||
|
||||
labelTable.addCell(ITextHelper.createCell(LANDING_VELOCITY, 2, 2));
|
||||
labelTable.addCell(ITextHelper.createCell(velocityUnit.toStringUnit(flight.getGroundHitVelocity()), 2, 2));
|
||||
@ -501,7 +501,7 @@ public class DesignReport {
|
||||
try {
|
||||
for (int i = 0; i < simulations.size(); i++) {
|
||||
Simulation simulation = simulations.get(i);
|
||||
if (simulation.getOptions().getMotorConfigurationID().equals(motorId)) {
|
||||
if (Utils.equals(simulation.getOptions().getMotorConfigurationID(), motorId)) {
|
||||
simulation = simulation.copy();
|
||||
simulation.simulate();
|
||||
flight = simulation.getSimulatedData();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user