Skip to content

Commit

Permalink
Fix Comment and Improve Null Safety in ServerCustomConfigActivity (#3779
Browse files Browse the repository at this point in the history
)

Fixed the comment typo in ServerCustomConfigActivity and improved null safety in the bindingServer function by ensuring proper fallback for raw content. Simplified logic for setting editor content.
  • Loading branch information
CodeWithTamim authored Oct 25, 2024
1 parent ba54005 commit 28027b5
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,16 +48,14 @@ class ServerCustomConfigActivity : BaseActivity() {
}

/**
* bingding seleced server config
* Binding selected server config
*/
private fun bindingServer(config: ServerConfig): Boolean {
binding.etRemarks.text = Utils.getEditable(config.remarks)
val raw = MmkvManager.decodeServerRaw(editGuid)
if (raw.isNullOrBlank()) {
binding.editor.setTextContent(Utils.getEditable(config.fullConfig?.toPrettyPrinting().orEmpty()))
} else {
binding.editor.setTextContent(Utils.getEditable(raw))
}
val configContent = raw ?: config.fullConfig?.toPrettyPrinting().orEmpty()

binding.editor.setTextContent(Utils.getEditable(configContent))
return true
}

Expand Down

0 comments on commit 28027b5

Please sign in to comment.