Website Summary Files Commits Branches @commit @diff @stats
path: root / browser-cli.c
diff options
context:
space:
mode:
Commitf024262b49b9e48a4fec759cfa2ebfc0247e3de2 (patch)
Author
 Syndamia <kamen@syndamia.com>
2024-01-01 19:11:22 +0200
Committer
 Syndamia <kamen@syndamia.com>
2024-01-01 19:11:22 +0200
Filesa2d2d4d2326cc34babae11a5c694fa866663fecd /browser-cli.c
pico-web-f024262b49b9e48a4fec759cfa2ebfc0247e3de2.tar
pico-web-f024262b49b9e48a4fec759cfa2ebfc0247e3de2.tar.gz
pico-web-f024262b49b9e48a4fec759cfa2ebfc0247e3de2.zip
Parentf3ab0863404a8eb723ad09756a5aa53d054a0160 (diff)
[browser-cli] Fixed wrongly updating host and port
1 files changed, 2 insertions, 2 deletions
-rw-r--r--browser-cli.c4
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));
}