Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

Commit cf398d5

Browse files
committed
Fixes detekt issue with ReturnCount
1 parent f84c100 commit cf398d5

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

fluxc/src/main/java/org/wordpress/android/fluxc/model/EditorTheme.kt

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -88,19 +88,18 @@ data class BlockEditorSettings(
8888
get() = features?.removeFontFamilies()
8989

9090
private fun JsonElement.removeFontFamilies(): JsonElement {
91-
if (!isJsonObject) return this
92-
93-
val featuresObject = asJsonObject
94-
if (!featuresObject.has("typography")) return this
95-
96-
val typography = featuresObject.get("typography")
97-
if (!typography.isJsonObject) return this
98-
99-
val typographyObject = typography.asJsonObject
100-
if (!typographyObject.has("fontFamilies")) return this
101-
102-
typographyObject.remove("fontFamilies")
103-
return featuresObject
91+
if (isJsonObject && asJsonObject.has("typography")) {
92+
val featuresObject = asJsonObject
93+
val typography = featuresObject.get("typography")
94+
if (typography.isJsonObject) {
95+
val typographyObject = typography.asJsonObject
96+
if (typographyObject.has("fontFamilies")) {
97+
typographyObject.remove("fontFamilies")
98+
return featuresObject
99+
}
100+
}
101+
}
102+
return this
104103
}
105104
}
106105

0 commit comments

Comments
 (0)