diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-10-20 16:33:39 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-10-20 16:33:39 +0300 |
commit | 59a30d880b5af0be7c478123163e819e3b9d1f5f (patch) | |
tree | 4e0091d03ecaeb675da530b5f3fb5183f5e34bfe | |
parent | 66e10a25ef75da8722dcb757a9905f3bc685f3ef (diff) |
Fixed a potential crash
Be more robust in `init_Url()`.
-rw-r--r-- | src/gmutil.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gmutil.c b/src/gmutil.c index e44971d0..264e7ac8 100644 --- a/src/gmutil.c +++ b/src/gmutil.c | |||
@@ -35,6 +35,10 @@ iRegExp *newGemtextLink_RegExp(void) { | |||
35 | } | 35 | } |
36 | 36 | ||
37 | void init_Url(iUrl *d, const iString *text) { | 37 | void init_Url(iUrl *d, const iString *text) { |
38 | if (!text) { | ||
39 | iZap(*d); | ||
40 | return; | ||
41 | } | ||
38 | /* Handle "file:" as a special case since it only has the path part. */ | 42 | /* Handle "file:" as a special case since it only has the path part. */ |
39 | if (startsWithCase_String(text, "file://")) { | 43 | if (startsWithCase_String(text, "file://")) { |
40 | iZap(*d); | 44 | iZap(*d); |