mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-17 04:15:44 +00:00
u_config_json: Create root node on save if no config file loaded
If no config file is loaded, json->root can be uninitialized instead of NULL. Fixes #117
This commit is contained in:
parent
727612c0a5
commit
2b962a5bfb
|
@ -378,7 +378,7 @@ u_config_write(struct u_config_json *json)
|
|||
void
|
||||
u_config_json_save_calibration(struct u_config_json *json, struct xrt_settings_tracking *settings)
|
||||
{
|
||||
if (!json->root) {
|
||||
if (!json->file_loaded) {
|
||||
u_config_json_make_default_root(json);
|
||||
}
|
||||
cJSON *root = json->root;
|
||||
|
@ -435,7 +435,7 @@ make_pose(struct xrt_pose *pose)
|
|||
void
|
||||
u_config_json_save_overrides(struct u_config_json *json, struct xrt_tracking_override *overrides, size_t num_overrides)
|
||||
{
|
||||
if (!json->root) {
|
||||
if (!json->file_loaded) {
|
||||
u_config_json_make_default_root(json);
|
||||
}
|
||||
cJSON *root = json->root;
|
||||
|
|
Loading…
Reference in a new issue