Skip to content

Commit 2c909e7

Browse files
committed
Report UKNONWN only on error
1 parent fbb9fc9 commit 2c909e7

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

aztec/src/main/kotlin/org/wordpress/aztec/AztecText.kt

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -184,17 +184,15 @@ open class AztecText : AppCompatEditText, TextWatcher, UnknownHtmlSpan.OnUnknown
184184
}
185185

186186
fun hasChanges(initialEditorContentParsedSHA256: ByteArray, newContent: String): EditorHasChanges {
187-
if (!initialEditorContentParsedSHA256.isEmpty()) {
188-
try {
189-
if (Arrays.equals(initialEditorContentParsedSHA256, calculateSHA256(newContent))) {
190-
return EditorHasChanges.NO_CHANGES
191-
}
192-
return EditorHasChanges.CHANGES
193-
} catch (e: Throwable) {
194-
// Do nothing here. `toPlainHtml` can throw exceptions, also calculateSHA256 -> NoSuchAlgorithmException
187+
try {
188+
if (Arrays.equals(initialEditorContentParsedSHA256, calculateSHA256(newContent))) {
189+
return EditorHasChanges.NO_CHANGES
195190
}
191+
return EditorHasChanges.CHANGES
192+
} catch (e: Throwable) {
193+
// Do nothing here. `toPlainHtml` can throw exceptions, also calculateSHA256 -> NoSuchAlgorithmException
194+
return EditorHasChanges.UNKNOWN
196195
}
197-
return EditorHasChanges.UNKNOWN
198196
}
199197
}
200198

0 commit comments

Comments
 (0)