selection: uri decode: move zero-length check into decode_one_uri()

This commit is contained in:
Daniel Eklöf 2021-01-12 14:56:47 +01:00
parent 497b8e6c0a
commit 3be80622ef
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -1490,6 +1490,9 @@ decode_one_uri(struct clipboard_receive *ctx, char *uri, size_t len)
{
LOG_DBG("URI: \"%.*s\"", (int)len, uri);
if (len == 0)
return false;
char *scheme, *host, *path;
if (!uri_parse(uri, len, &scheme, NULL, NULL, &host, NULL, &path, NULL, NULL)) {
LOG_ERR("drag-and-drop: invalid URI: %.*s", (int)len, uri);
@ -1544,8 +1547,7 @@ static void
fdm_receive_finish_uri(struct clipboard_receive *ctx)
{
LOG_DBG("finish: %.*s", (int)ctx->buf.idx, ctx->buf.data);
if (ctx->buf.idx > 0)
decode_one_uri(ctx, ctx->buf.data, ctx->buf.idx);
decode_one_uri(ctx, ctx->buf.data, ctx->buf.idx);
}
static bool