Skip to content

Commit

Permalink
Stop ConfigManager from setting a default when calling GetOriginalBin…
Browse files Browse the repository at this point in the history
…dable

This behaviour wasn't even correct as `default(U)` would not match the expected type for cases like `BindableDouble`.
  • Loading branch information
peppy committed Jan 25, 2018
1 parent 332d133 commit 1e46bc2
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions osu.Framework/Configuration/ConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,19 +129,14 @@ private Bindable<U> set<U>(T lookup, U value)
return bindable;
}

public U Get<U>(T lookup)
{
return GetOriginalBindable<U>(lookup).Value;
}
public U Get<U>(T lookup) => GetOriginalBindable<U>(lookup).Value;

protected Bindable<U> GetOriginalBindable<U>(T lookup)
{
IBindable obj;

if (ConfigStore.TryGetValue(lookup, out obj))
if (ConfigStore.TryGetValue(lookup, out IBindable obj))
return obj as Bindable<U>;

return set(lookup, default(U));
return null;
}

/// <summary>
Expand Down

0 comments on commit 1e46bc2

Please sign in to comment.