summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/htsencoding.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/htsencoding.c b/src/htsencoding.c
index 21d6cde..e6e0ff6 100644
--- a/src/htsencoding.c
+++ b/src/htsencoding.c
@@ -270,7 +270,7 @@ int hts_unescapeUrlSpecial(const char *src, char *dest, const size_t max,
/* First character */
if (k == 0) {
/* New destination-centric offset of utf-8 buffer beginning */
- if (i == lastI + 2) { /* just read a %xx */
+ if (lastI != (size_t) -1 && i == lastI + 2) { /* just read a %xx */
utfBufferJ = lastJ; /* position of % */
} else {
utfBufferJ = j; /* current position otherwise */