@@ -59,32 +59,35 @@ func Search(ctx context.Context, req *rpc.BoardSearchRequest) (*rpc.BoardSearchR
5959 for _ , targetPackage := range pm .Packages {
6060 for _ , platform := range targetPackage .Platforms {
6161 latestPlatformRelease := platform .GetLatestRelease ()
62- if latestPlatformRelease == nil {
62+ installedPlatformRelease := pm .GetInstalledPlatformRelease (platform )
63+
64+ if latestPlatformRelease == nil && installedPlatformRelease == nil {
6365 continue
6466 }
65- installedVersion := ""
66- if installedPlatformRelease := pm .GetInstalledPlatformRelease (platform ); installedPlatformRelease != nil {
67- installedVersion = installedPlatformRelease .Version .String ()
68- }
6967
7068 rpcPlatform := & rpc.Platform {
7169 Id : platform .String (),
72- Installed : installedVersion ,
73- Latest : latestPlatformRelease .Version .String (),
7470 Name : platform .Name ,
7571 Maintainer : platform .Package .Maintainer ,
7672 Website : platform .Package .WebsiteURL ,
7773 Email : platform .Package .Email ,
7874 ManuallyInstalled : platform .ManuallyInstalled ,
7975 }
8076
77+ if latestPlatformRelease != nil {
78+ rpcPlatform .Latest = latestPlatformRelease .Version .String ()
79+ }
80+ if installedPlatformRelease != nil {
81+ rpcPlatform .Installed = installedPlatformRelease .Version .String ()
82+ }
83+
8184 // Platforms that are not installed don't have a list of boards
8285 // generated from their boards.txt file so we need two different
8386 // ways of reading board data.
8487 // The only boards information for platforms that are not installed
8588 // is that found in the index, usually that's only a board name.
86- if len ( latestPlatformRelease . Boards ) != 0 {
87- for _ , board := range latestPlatformRelease .Boards {
89+ if installedPlatformRelease != nil {
90+ for _ , board := range installedPlatformRelease .Boards {
8891 if ! req .GetIncludeHiddenBoards () && board .IsHidden () {
8992 continue
9093 }
@@ -103,7 +106,7 @@ func Search(ctx context.Context, req *rpc.BoardSearchRequest) (*rpc.BoardSearchR
103106 Platform : rpcPlatform ,
104107 })
105108 }
106- } else {
109+ } else if latestPlatformRelease != nil {
107110 for _ , board := range latestPlatformRelease .BoardsManifest {
108111 toTest := append (strings .Split (board .Name , " " ), board .Name )
109112 if ok , err := match (toTest ); err != nil {
0 commit comments