Skip to content

Commit 69a309f

Browse files
committed
fix regression introduced: target platform could be nil so using before checking is not a good idea
1 parent cee3ddd commit 69a309f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

commands/compile/compile.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,7 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
118118
Package: fqbn.Package,
119119
PlatformArchitecture: fqbn.PlatformArch,
120120
})
121-
InstalledPlatformRelease := pm.GetInstalledPlatformRelease(targetPlatform)
122-
if targetPlatform == nil || InstalledPlatformRelease == nil {
121+
if targetPlatform == nil || pm.GetInstalledPlatformRelease(targetPlatform) == nil {
123122
return nil, &arduino.PlatformNotFoundError{
124123
Platform: fmt.Sprintf("%s:%s", fqbn.Package, fqbn.PlatformArch),
125124
Cause: fmt.Errorf(tr("platform not installed")),
@@ -143,6 +142,7 @@ func Compile(ctx context.Context, req *rpc.CompileRequest, outStream, errStream
143142
if !encryptKeyPath.Exist() {
144143
return nil, &arduino.NotFoundError{Message: tr("The path of the specified encription key do not exist: %s", encryptKeyPath), Cause: err}
145144
}
145+
InstalledPlatformRelease := pm.GetInstalledPlatformRelease(targetPlatform)
146146
ReplaceSecurityKeys(InstalledPlatformRelease.Properties, req.Keysdir, req.Signkeyname, req.Encryptkeyname)
147147
}
148148

0 commit comments

Comments
 (0)