From 55e383ae38ecc54fb19948eac23ffefa60c829ea Mon Sep 17 00:00:00 2001
From: Denis Dzyubenko <denis@ddenis.info>
Date: Tue, 1 Aug 2023 10:55:28 +0200
Subject: [PATCH] Fix fetch instance software version from nodeinfo (#3772)

Fixes #3771
---
 src/scheduled_tasks.rs | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/scheduled_tasks.rs b/src/scheduled_tasks.rs
index c44d61f2..28315bea 100644
--- a/src/scheduled_tasks.rs
+++ b/src/scheduled_tasks.rs
@@ -387,12 +387,13 @@ fn update_instance_software(conn: &mut PgConnection, user_agent: &str) -> LemmyR
       Ok(res) => match res.json::<NodeInfo>() {
         Ok(node_info) => {
           // Instance sent valid nodeinfo, write it to db
+          let software = node_info.software.as_ref();
           Some(
             InstanceForm::builder()
               .domain(instance.domain)
               .updated(Some(naive_now()))
-              .software(node_info.software.and_then(|s| s.name))
-              .version(node_info.version.clone())
+              .software(software.and_then(|s| s.name.clone()))
+              .version(software.and_then(|s| s.version.clone()))
               .build(),
           )
         }
-- 
2.44.1