mark: Avoid address sanitizer error

This commit is contained in:
ZyX
2015-08-14 00:02:27 +03:00
parent e4c0741206
commit 5941380f49

View File

@@ -1349,10 +1349,11 @@ size_t mark_buffer_amount(const buf_T *const buf)
/// @return true on success, false on failure. /// @return true on success, false on failure.
bool mark_set_global(const char name, const xfmark_T fm, const bool update) bool mark_set_global(const char name, const xfmark_T fm, const bool update)
{ {
xfmark_T *fm_tgt = &(namedfm[mark_global_index(name)]); const int idx = mark_global_index(name);
if (fm_tgt == &namedfm[0] - 1) { if (idx == -1) {
return false; return false;
} }
xfmark_T *const fm_tgt = &(namedfm[idx]);
if (update && fm.fmark.timestamp <= fm_tgt->fmark.timestamp) { if (update && fm.fmark.timestamp <= fm_tgt->fmark.timestamp) {
return false; return false;
} }