Skip to content

Commit 1ba25ce

Browse files
committed
Fix exception when no URL yet
toURL() will throw if the string is blank, which it will be on the very first time Gateway is launched.
1 parent 117fd54 commit 1ba25ce

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
- Default URL setting was showing the help text for the setup command instead of
1010
its own description.
11+
- Exception when there is no default or last used URL.
1112

1213
## 2.11.2 - 2024-04-30
1314

src/main/kotlin/com/coder/gateway/views/steps/CoderWorkspacesStepView.kt

+2-2
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ class CoderWorkspacesStepView : CoderWizardStep<CoderWorkspacesStepSelection>(
509509
* unless retry is false.
510510
*/
511511
private fun maybeAskTokenThenConnect(isRetry: Boolean = false) {
512-
val oldURL = fields.coderURL.toURL()
512+
val oldURL = fields.coderURL
513513
component.apply() // Force bindings to be filled.
514514
val newURL = fields.coderURL.toURL()
515515
if (settings.requireTokenAuth) {
@@ -518,7 +518,7 @@ class CoderWorkspacesStepView : CoderWizardStep<CoderWorkspacesStepSelection>(
518518
newURL,
519519
// If this is a new URL there is no point in trying to use the same
520520
// token.
521-
if (oldURL.toString() == newURL.toString()) fields.token else null,
521+
if (oldURL == newURL.toString()) fields.token else null,
522522
isRetry,
523523
fields.useExistingToken,
524524
settings,

0 commit comments

Comments
 (0)