Pull request: home: fix install panic

Closes #3596.

Squashed commit of the following:

commit e14f8795859cf775b360d4fe2f5c1d0eebb87ba6
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Sep 14 17:49:48 2021 +0300

    home: fix install panic
This commit is contained in:
Ainar Garipov 2021-09-14 18:03:14 +03:00
parent 857f876486
commit 48b0cefb29
2 changed files with 7 additions and 5 deletions

View File

@ -49,8 +49,8 @@ and this project adheres to
- The `systemd` service script will now create the `/var/log` directory when it - The `systemd` service script will now create the `/var/log` directory when it
doesn't exist ([#3579]). doesn't exist ([#3579]).
- Items in allowed clients, disallowed clients, and blocked hosts lists must - Items in allowed clients, disallowed clients, and blocked hosts lists are now
be unique ([#3419]). required to be unique ([#3419]).
- The TLS private key previously saved as a string isn't shown in API responses - The TLS private key previously saved as a string isn't shown in API responses
anymore ([#1898]). anymore ([#1898]).
- Better OpenWrt detection ([#3435]). - Better OpenWrt detection ([#3435]).
@ -115,7 +115,8 @@ In this release, the schema version has changed from 10 to 12.
### Fixed ### Fixed
- Panic when upstream server responds with empty question section ([#3551]). - Panic when an upstream server responds with an empty question section
([#3551]).
- 9GAG blocking ([#3564]). - 9GAG blocking ([#3564]).
- DHCP now follows RFCs more closely when it comes to response sending and - DHCP now follows RFCs more closely when it comes to response sending and
option selection ([#3443], [#3538]). option selection ([#3443], [#3538]).

View File

@ -257,7 +257,8 @@ type applyConfigReq struct {
Password string `json:"password"` Password string `json:"password"`
} }
// Copy installation parameters between two configuration objects // copyInstallSettings copies the installation parameters between two
// configuration structures.
func copyInstallSettings(dst, src *configuration) { func copyInstallSettings(dst, src *configuration) {
dst.BindHost = src.BindHost dst.BindHost = src.BindHost
dst.BindPort = src.BindPort dst.BindPort = src.BindPort
@ -307,7 +308,7 @@ func (web *Web) handleInstallConfigure(w http.ResponseWriter, r *http.Request) {
return return
} }
var curConfig *configuration curConfig := &configuration{}
copyInstallSettings(curConfig, config) copyInstallSettings(curConfig, config)
Context.firstRun = false Context.firstRun = false