Always set an error when failing name validation

This was an oversight in the previous patch to improve
name validation error messages.
This commit is contained in:
Matthias Clasen
2016-09-13 13:13:43 -04:00
parent 38a6b8d5e4
commit 687cae783e

View File

@@ -416,8 +416,19 @@ flatpak_is_valid_name (const char *string,
ret = FALSE;
len = strlen (string);
if (G_UNLIKELY (len == 0 || len > 255))
goto out;
if (G_UNLIKELY (len == 0))
{
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Name can't be empty");
goto out;
}
if (G_UNLIKELY (len > 255))
{
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Name can't be longer than 255 characters");
goto out;
}
end = string + len;