diff --git a/third_party/imgui_club/imgui_memory_editor.h b/third_party/imgui_club/imgui_memory_editor.h
index 97c4b77..85924ca 100644
--- a/third_party/imgui_club/imgui_memory_editor.h
+++ b/third_party/imgui_club/imgui_memory_editor.h
@@ -321,8 +321,8 @@ struct MemoryEditor
                     }
                     else if (BgColorFn != nullptr)
                     {
-                        is_next_byte_highlighted = (addr + 1 < mem_size) && ((BgColorFn(mem_data, addr + 1, UserData) & IM_COL32_A_MASK) != 0);
                         bg_color = BgColorFn(mem_data, addr, UserData);
+                        is_next_byte_highlighted = (addr + 1 < mem_size) && ((BgColorFn(mem_data, addr + 1, UserData) & IM_COL32_A_MASK) != 0);
                     }
                     if (bg_color != 0)
                     {