Skip to content

Commit 4837fe1

Browse files
Fix error in NoForkingMode.
Previous commit threw exception if conversion is running for a second time. Exception is supposed to be thrown if conversion is running for a second time in no forking mode.
1 parent 35f2f94 commit 4837fe1

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

  • pdf2htmlEX/src/main/java/com/viliussutkus89/android/pdf2htmlex

pdf2htmlEX/src/main/java/com/viliussutkus89/android/pdf2htmlex/pdf2htmlEX.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public final class pdf2htmlEX {
4343
private String p_ownerPassword = "";
4444
private String p_userPassword = "";
4545

46+
private boolean m_isNoForking = false;
4647
private boolean m_noForkingConversionAlreadyDone = false;
4748

4849
public static class ConversionFailedException extends Exception {
@@ -112,10 +113,11 @@ public pdf2htmlEX setUserPassword(@NonNull String userPassword) {
112113
return this;
113114
}
114115

115-
public pdf2htmlEX setNoForking(@NonNull boolean iDoUnderstandThatIWillHaveToRestartTheAppBeforeICanRunConversionForTheSecondTime) throws IllegalArgumentException {
116+
public pdf2htmlEX setNoForking(boolean iDoUnderstandThatIWillHaveToRestartTheAppBeforeICanRunConversionForTheSecondTime) throws IllegalArgumentException {
116117
if (!iDoUnderstandThatIWillHaveToRestartTheAppBeforeICanRunConversionForTheSecondTime) {
117118
throw new IllegalArgumentException();
118119
}
120+
this.m_isNoForking = true;
119121
setNoForking();
120122
return this;
121123
}
@@ -149,7 +151,9 @@ public File convert() throws IOException, ConversionFailedException {
149151
this.p_ownerPassword, this.p_userPassword
150152
);
151153

152-
this.m_noForkingConversionAlreadyDone = true;
154+
if (this.m_isNoForking) {
155+
this.m_noForkingConversionAlreadyDone = true;
156+
}
153157

154158
if (0 != retVal) {
155159
outputHtml.delete();

0 commit comments

Comments
 (0)