mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-11-14 07:13:46 +01:00
Only allow the creation of supported annotation types
This commit is contained in:
parent
9d9915e8dd
commit
0176b7e4ce
@ -21,6 +21,21 @@ zathura_annotation_t*
|
||||
zathura_annotation_new(zathura_annotation_type_t type)
|
||||
{
|
||||
zathura_annotation_t* annotation = calloc(1, sizeof(zathura_annotation_t));
|
||||
if (annotation == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case ZATHURA_ANNOTATION_TEXT:
|
||||
case ZATHURA_ANNOTATION_FREE_TEXT:
|
||||
case ZATHURA_ANNOTATION_FILE_ATTACHMENT:
|
||||
case ZATHURA_ANNOTATION_MOVIE:
|
||||
case ZATHURA_ANNOTATION_SCREEN:
|
||||
break;
|
||||
default:
|
||||
free(annotation);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
annotation->type = type;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user