From d10f362b544313560ecd3b0b87cb34a685276800 Mon Sep 17 00:00:00 2001 From: tan Date: Sun, 24 Jan 2016 13:11:55 +0530 Subject: [PATCH] fix share! of inputs check for null case before sharing --- src/input.jl | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/input.jl b/src/input.jl index e72a8ce..3c7f93b 100644 --- a/src/input.jl +++ b/src/input.jl @@ -41,17 +41,25 @@ function localize!(inp::SharedMemoryInputs) end function share!(inp::SharedMemoryInputs) - R = get(inp.R) - isa(R, SharedRatingMatrix) || (inp.R = share(R)) + if !isnull(inp.R) + R = get(inp.R) + isa(R, SharedRatingMatrix) || (inp.R = share(R)) + end - RT = get(inp.RT) - isa(RT, SharedRatingMatrix) || (inp.RT = share(RT)) + if !isnull(inp.RT) + RT = get(inp.RT) + isa(RT, SharedRatingMatrix) || (inp.RT = share(RT)) + end - item_idmap = get(inp.item_idmap) - isa(item_idmap, SharedVector) || (inp.item_idmap = share(item_idmap)) + if !isnull(inp.item_idmap) + item_idmap = get(inp.item_idmap) + isa(item_idmap, SharedVector) || (inp.item_idmap = share(item_idmap)) + end - user_idmap = get(inp.user_idmap) - isa(user_idmap, SharedVector) || (inp.user_idmap = share(user_idmap)) + if !isnull(inp.user_idmap) + user_idmap = get(inp.user_idmap) + isa(user_idmap, SharedVector) || (inp.user_idmap = share(user_idmap)) + end nothing end