summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java
diff options
context:
space:
mode:
authorTobias Kellner <tobias.kellner@iaik.tugraz.at>2016-06-30 14:44:04 +0200
committerTobias Kellner <tobias.kellner@iaik.tugraz.at>2016-06-30 14:44:04 +0200
commit967a0f646db5bbd802e7ee562ef1891078b51c10 (patch)
tree83a88e25a2a0d23573fbddbcaad307c5c12cd166 /pdf-over-gui/src/main/java
parented6382d02cb8a241234574400a1f6a5a31d87796 (diff)
downloadpdf-over-967a0f646db5bbd802e7ee562ef1891078b51c10.tar.gz
pdf-over-967a0f646db5bbd802e7ee562ef1891078b51c10.tar.bz2
pdf-over-967a0f646db5bbd802e7ee562ef1891078b51c10.zip
Fail safety
Diffstat (limited to 'pdf-over-gui/src/main/java')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java9
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java4
2 files changed, 10 insertions, 3 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java
index 1ca05015..7f42db8f 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/PositioningComposite.java
@@ -409,9 +409,12 @@ public class PositioningComposite extends StateComposite {
* the signature position
*/
void setFinalPosition() {
- this.position = new SignaturePosition(
- this.viewer.getSignaturePositionX(),
- this.viewer.getSignaturePositionY(), this.currentPage);
+ if (this.currentPage == 0)
+ this.position = new SignaturePosition();
+ else
+ this.position = new SignaturePosition(
+ this.viewer.getSignaturePositionX(),
+ this.viewer.getSignaturePositionY(), this.currentPage);
PositioningComposite.this.state.updateStateMachine();
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java
index 264ccd2f..34c1112f 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/composites/SignaturePanel.java
@@ -198,6 +198,8 @@ public class SignaturePanel extends JPanel {
* @return signature x coordinate
*/
public float getSignaturePositionX() {
+ if (this.sigPagePos == null)
+ return 0;
return Math.max((float) this.sigPagePos.getX(), 0);
}
@@ -206,6 +208,8 @@ public class SignaturePanel extends JPanel {
* @return signature y coordinate
*/
public float getSignaturePositionY() {
+ if (this.sigPagePos == null)
+ return 0;
return Math.max((float) this.sigPagePos.getY(), 0);
}