VirtualBox

Changeset 94348 in vbox


Ignore:
Timestamp:
Mar 24, 2022 8:13:46 AM (3 years ago)
Author:
vboxsync
Message:

Main/Unattended: ​​bugref:9781. Adding a default label line to menu config. file in case it is missing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/UnattendedInstaller.cpp

    r94346 r94348  
    11711171            return E_FAIL;
    11721172        /* Modify the content of default lines so that they point to label we have chosen above. */
     1173        Utf8Str strNewContent("default ");
     1174        strNewContent.append(pszNewLabel);
     1175
    11731176        std::vector<size_t> vecDefaultLineNumbers = pEditor->findTemplate("default", RTCString::CaseInsensitive);
    1174         for (size_t j = 0; j < vecDefaultLineNumbers.size(); ++j)
    1175         {
    1176             Utf8Str strNewContent("default ");
    1177             strNewContent.append(pszNewLabel);
    1178             HRESULT hrc = pEditor->setContentOfLine(vecDefaultLineNumbers[j], strNewContent);
     1177        if (!vecDefaultLineNumbers.empty())
     1178        {
     1179            for (size_t j = 0; j < vecDefaultLineNumbers.size(); ++j)
     1180            {
     1181                HRESULT hrc = pEditor->setContentOfLine(vecDefaultLineNumbers[j], strNewContent);
     1182                if (FAILED(hrc))
     1183                    return hrc;
     1184            }
     1185        }
     1186        /* Add a defaul label line. */
     1187        else
     1188        {
     1189            HRESULT hrc = pEditor->appendLine(strNewContent);
    11791190            if (FAILED(hrc))
    11801191                return hrc;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette