From c736ad9fbe5ed8b93a50e36be12bc27f2297e539 Mon Sep 17 00:00:00 2001
From: alemi <me@alemi.dev>
Date: Sat, 15 Feb 2025 16:28:22 +0100
Subject: [PATCH] fix: hash nil when not present

---
 build.lua              | 2 +-
 lua/codemp/buffers.lua | 5 +----
 2 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/build.lua b/build.lua
index b4a7f5e..75aa1ed 100644
--- a/build.lua
+++ b/build.lua
@@ -8,7 +8,7 @@
 -- `native.(so|dll|dylib)` file in this plugin folder, next to
 -- the `loader.lua` file.
 
-local version = "v0.8.4"
+local version = "v0.8.5"
 
 
 local plugin_dir = vim.fn.fnamemodify(debug.getinfo(1, "S").source:sub(2), ":p:h") -- got this from https://lazy.folke.io/developers#building
diff --git a/lua/codemp/buffers.lua b/lua/codemp/buffers.lua
index 92bc0da..e7464e6 100644
--- a/lua/codemp/buffers.lua
+++ b/lua/codemp/buffers.lua
@@ -142,10 +142,7 @@ local function attach(name, opts)
 					if event == nil then break end
 
 					-- error detection
-					-- TODO Option::None gets serialized as userdata : NULL, so nil check doesnt work...
-					--      next version field will be skipped if hash is None
-					--if event.hash ~= nil and CODEMP.native.hash(utils.buffer.get_content(buffer)) ~= event.hash then
-					if type(event.hash) ~= "userdata" and CODEMP.native.hash(utils.buffer.get_content(buffer)) ~= event.hash then
+					if event.hash ~= nil and CODEMP.native.hash(utils.buffer.get_content(buffer)) ~= event.hash then
 						if CODEMP.config.auto_sync then
 							print(" /!\\ out of sync, resynching...")
 							ticks[buffer] = vim.api.nvim_buf_get_changedtick(buffer)