Skip to content

GetBool with default value of true always returns true #1

@Jamroah

Description

@Jamroah

SetBool(false) sets an int of 0. GetBool only returns true if GetInt returns 1, or default value, so even if it returns a 0 GetBool with a default value of true will always return true.

Suggest replacing the GetBool function with:

public static bool GetBool(string key, bool defaultValue) {
    int i = GetInt(key, (defaultValue ? 1 : 0));
    return i == 1;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions