net: lib: lwm2m: Fix lwm2m exec

The lwm2m exec erroneously checked the previous return value
instead of checking if the resource existed. This caused exec
to try to get and execute the execute callback from NULL and caused
a reboot.

Signed-off-by: Jarno Lämsä <jarno.lamsa@nordicsemi.no>
diff --git a/subsys/net/lib/lwm2m/lwm2m_shell.c b/subsys/net/lib/lwm2m/lwm2m_shell.c
index 3c85b16..6fbe954 100644
--- a/subsys/net/lib/lwm2m/lwm2m_shell.c
+++ b/subsys/net/lib/lwm2m/lwm2m_shell.c
@@ -117,8 +117,8 @@
 
 	struct lwm2m_engine_res *res = lwm2m_engine_get_res(&path);
 
-	if (ret < 0) {
-		shell_error(sh, "Resource not found (err %d)\n", ret);
+	if (res == NULL) {
+		shell_error(sh, "Resource not found\n");
 		return -EINVAL;
 	}