Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix a logic error
  • Loading branch information
axel-op committed Nov 27, 2019
commit c8a838485a449f9e8435aee3027ffaff8bcdab1d
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;

/**
Expand Down Expand Up @@ -58,12 +57,10 @@ class MethodCallHandlerImpl implements MethodChannel.MethodCallHandler {
* @return An instance of {@link SharedPreferences}.
*/
private SharedPreferences getPreferences(String filename) {
if (filename == null) filename = SHARED_PREFERENCES_DEFAULT_NAME;
SharedPreferences instance = instances.get(filename);
if (instance == null) {
instance =
context.getSharedPreferences(
Optional.ofNullable(filename).orElse(SHARED_PREFERENCES_DEFAULT_NAME),
Context.MODE_PRIVATE);
instance = context.getSharedPreferences(filename, Context.MODE_PRIVATE);
instances.put(filename, instance);
}
return instance;
Expand Down