aboutsummaryrefslogtreecommitdiff
path: root/browser-cli.c
diff options
context:
space:
mode:
authorSyndamia <kamen@syndamia.com>2024-01-01 19:11:22 +0200
committerSyndamia <kamen@syndamia.com>2024-01-01 19:11:22 +0200
commitf024262b49b9e48a4fec759cfa2ebfc0247e3de2 (patch)
treea2d2d4d2326cc34babae11a5c694fa866663fecd /browser-cli.c
parentf3ab0863404a8eb723ad09756a5aa53d054a0160 (diff)
downloadpico-web-f024262b49b9e48a4fec759cfa2ebfc0247e3de2.tar
pico-web-f024262b49b9e48a4fec759cfa2ebfc0247e3de2.tar.gz
pico-web-f024262b49b9e48a4fec759cfa2ebfc0247e3de2.zip
[browser-cli] Fixed wrongly updating host and port
Diffstat (limited to 'browser-cli.c')
-rw-r--r--browser-cli.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/browser-cli.c b/browser-cli.c
index 64d5a73..d3d4c2f 100644
--- a/browser-cli.c
+++ b/browser-cli.c
@@ -151,13 +151,13 @@ int handleCLI(sds *host, sds *port, sds *uri, const sds page) {
char* startPort = strchr(newURI, ':');
// Update host
- if (startHost < startPath) {
+ if (startHost != NULL && startHost < startPath) {
if (host != NULL) sdsfree(*host);
*host = sdsnewlen(startHost + 1, hostLen(startHost + 1));
}
// Update port
- if (startPort < startPath) {
+ if (startPort != NULL && startPort < startPath) {
if (port != NULL) sdsfree(*port);
*port = sdsnewlen(startPort + 1, portLen(startPort + 1));
}