diff --git a/core/src/main/kotlin/io/github/serpro69/kfaker/FakerService.kt b/core/src/main/kotlin/io/github/serpro69/kfaker/FakerService.kt index 7d6df200d..cdb23553b 100644 --- a/core/src/main/kotlin/io/github/serpro69/kfaker/FakerService.kt +++ b/core/src/main/kotlin/io/github/serpro69/kfaker/FakerService.kt @@ -584,9 +584,8 @@ class FakerService { * has declared a provider that matches the [simpleClassName] parameter. */ private fun getProviderData(primary: YamlCategory, secondary: Category? = null): YamlCategoryData { - return secondary?.let { - load(primary, secondary)[primary] - } ?: dictionary[primary] + return dictionary[primary] + ?: secondary?.let { load(primary, secondary)[primary] } ?: load(primary)[primary] ?: throw NoSuchElementException("Category $primary not found in $this") }