Skip to content

Commit ebbd1d9

Browse files
committed
Fixes from manual testing
1 parent 628fd7b commit ebbd1d9

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

src/AppInstallerCLICore/Commands/DscAdminSettingsResource.cpp

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ namespace AppInstaller::CLI
2222
virtual Utility::LocIndView SettingName() const = 0;
2323

2424
// Tests the value.
25-
// Returns true if in the deired state; false if not.
25+
// Returns true if in the desired state; false if not.
2626
virtual bool Test() const = 0;
2727

2828
// Sets the value.
@@ -120,9 +120,20 @@ namespace AppInstaller::CLI
120120
auto stringSetting = Settings::StringToStringAdminSetting(property);
121121
if (stringSetting != Settings::StringAdminSetting::Unknown)
122122
{
123-
std::string value = inputSettings[property].asString();
124-
AICLI_LOG(Config, Info, << "String admin setting: " << property << " => " << value);
125-
InputSettings.emplace_back(std::make_unique<AdminSettingsDetails::AdminSetting_String>(stringSetting, value));
123+
const auto& propertyNode = inputSettings[property];
124+
std::optional<std::string> value;
125+
126+
if (propertyNode.isNull())
127+
{
128+
AICLI_LOG(Config, Info, << "String admin setting: " << property << " => null");
129+
}
130+
else
131+
{
132+
value = propertyNode.asString();
133+
AICLI_LOG(Config, Info, << "String admin setting: " << property << " => `" << value.value() << "`");
134+
}
135+
136+
InputSettings.emplace_back(std::make_unique<AdminSettingsDetails::AdminSetting_String>(stringSetting, std::move(value)));
126137
continue;
127138
}
128139

src/AppInstallerCLICore/Commands/DscComposableObject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ namespace AppInstaller::CLI
162162

163163
static void FromJson(Derived* self, const Json::Value* value, bool ignoreFieldRequirements)
164164
{
165-
if (value)
165+
if (value && !value->isNull())
166166
{
167167
self->m_value = GetJsonTypeValue<PropertyType>::Get(*value);
168168
}

0 commit comments

Comments
 (0)