Skip to content

Commit 8daf390

Browse files
committed
Fixed certificate checking logic to avoid an uninitialized variable.
1 parent afd8065 commit 8daf390

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

mlapptools.m

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -456,13 +456,13 @@ function unlockUIFig(hUIFig)
456456
% - In Chromium, visit chrome://settings/certificates, click Authorities,
457457
% then click import, and select your .pem.
458458
% - In Firefox, visit about:preferences#privacy, click Certificates,
459-
% View Certificates, Authorities, then click Import and select your .pem.
459+
% View Certificates, Authorities, then click Import and select your .pem.
460460
SUCCESS_CODE = 0;
461461
CL = connector.getCertificateLocation(); % certificate location;
462462
if isempty(CL), CL = fullfile(prefdir, 'thisMatlab.pem'); end
463463
%% Test if certificate is already accepted:
464464
switch true
465-
case ispc
465+
case ispc
466466
[s,c] = system('certutil -verifystore -user "Root" localhost');
467467
case isunix
468468
[s,c] = system(['openssl crl2pkcs7 -nocrl -certfile '...
@@ -475,7 +475,9 @@ function unlockUIFig(hUIFig)
475475
isAccepted = s == SUCCESS_CODE;
476476

477477
%% Try to import certificate:
478-
if ~isAccepted
478+
if isAccepted
479+
wasImported = false;
480+
else
479481
reply = questdlg('Certificate not found. Would you like to import it?',...
480482
'Import "localhost" certificate','Yes','No','Yes');
481483
if strcmp(reply,'Yes'), switch true %#ok<ALIGN>
@@ -518,7 +520,7 @@ function unlockUIFig(hUIFig)
518520
' > Import, and select your .pem.'],...
519521
['- In Firefox, visit about:preferences#privacy, click Certificates > ',...
520522
'View Certificates > Authorities > Import, and select your .pem.'],...
521-
['The certificate is found here: ' CL ]);
523+
['The certificate is found here: ' CL ]);
522524
end
523525
end % checkCert
524526
end % unlockUIFig

0 commit comments

Comments
 (0)