[fix] return NULL from transliterator_read on failure
This commit is contained in:
@@ -1262,31 +1262,31 @@ transliterator_t *transliterator_read(FILE *f) {
|
|||||||
|
|
||||||
|
|
||||||
if (!file_read_uint64(f, (uint64_t *)&trans_name_len)) {
|
if (!file_read_uint64(f, (uint64_t *)&trans_name_len)) {
|
||||||
return false;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
char name[trans_name_len];
|
char name[trans_name_len];
|
||||||
|
|
||||||
if (!file_read_chars(f, name, trans_name_len)) {
|
if (!file_read_chars(f, name, trans_name_len)) {
|
||||||
return false;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool internal;
|
bool internal;
|
||||||
if (!file_read_uint8(f, (uint8_t *)&internal)) {
|
if (!file_read_uint8(f, (uint8_t *)&internal)) {
|
||||||
return false;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t steps_index;
|
uint32_t steps_index;
|
||||||
|
|
||||||
if (!file_read_uint32(f, &steps_index)) {
|
if (!file_read_uint32(f, &steps_index)) {
|
||||||
return false;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint32_t steps_length;
|
uint32_t steps_length;
|
||||||
|
|
||||||
if (!file_read_uint32(f, &steps_length)) {
|
if (!file_read_uint32(f, &steps_length)) {
|
||||||
return false;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
transliterator_t *trans = transliterator_new(name, internal, steps_index, steps_length);
|
transliterator_t *trans = transliterator_new(name, internal, steps_index, steps_length);
|
||||||
|
|||||||
Reference in New Issue
Block a user