Skip to content

Commit df410b1

Browse files
committed
fix(chat): handle empty ragsJsonConfig in AutoDevInputSection #51
Prevent potential crashes by ensuring that the list of CustomAgentConfigs is not empty before attempting to decode the JSON string.
1 parent d307861 commit df410b1

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/main/kotlin/cc/unitmesh/devti/gui/chat/AutoDevInputSection.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@ class AutoDevInputSection(private val project: Project, val disposable: Disposab
152152

153153
private fun loadRagApps(): List<CustomAgentConfig> {
154154
val ragsJsonConfig = project.customRagSettings.ragsJsonConfig
155+
if (ragsJsonConfig.isEmpty()) return listOf(defaultRag)
156+
155157
val rags = try {
156158
Json.decodeFromString<List<CustomAgentConfig>>(ragsJsonConfig)
157159
} catch (e: Exception) {

0 commit comments

Comments
 (0)