Fix empty ca result handling
Change-Id: I564c30602207ec5463d98bf47c2d0633fa34819d
diff --git a/Project.toml b/Project.toml
index 7c4986e..1c5f287 100644
--- a/Project.toml
+++ b/Project.toml
@@ -1,7 +1,7 @@
name = "DerekoVecs"
uuid = "d522d5f0-9ae6-4a1c-b144-42ce9f15cae4"
authors = ["Marc Kupietz"]
-version = "0.4.0"
+version = "0.4.1"
[deps]
ArtifactUtils = "8b73e784-e7d8-4ea5-973d-377fed4e3bce"
diff --git a/src/DerekoVecs.jl b/src/DerekoVecs.jl
index 4af8f82..e9da4ca 100644
--- a/src/DerekoVecs.jl
+++ b/src/DerekoVecs.jl
@@ -1,5 +1,5 @@
module DerekoVecs
-export load, knn, cos_sim, d2vmodel, kld, kldResult, get_collocates
+export load, knn, cos_sim, d2vmodel, kld, kldResult, get_collocates, collocate
using Mmap
using DelimitedFiles
@@ -193,6 +193,10 @@
function get_collocates(cdb::Ptr{Nothing}, node::Int64)::Vector{collocate}
res = @ccall libcdb.get_collocators(cdb::Ptr{collocate}, node::Cuint)::Ptr{collocate}
+ if res == 0
+ return Vector{collocate}()
+ end
+
i = 0
for c in unsafe_wrap(Vector{collocate}, res, 1000, own=false)
if (c.w2 == 0)