Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content
Commit 8bf0dca1 authored by Hans Boehm's avatar Hans Boehm
Browse files

Do not use HISTORY_MAIN_INDEX as clipboard or memory index

Bug: 34697529

We were potentially saving HISTORY_MAIN_INDEX (-1) as the expression
index for the clipboard or memory expression, without actually saving
expression at that index.

Deal with the fact that sharedpreferences or the database may have
been corrupted with such spurious -1 values.

As part of this, we also make the memory operations much more
robust against trying to use an erroneous answer. This seems like
a good idea anyway, since there are probably other, also extremely
unlikely, cases in which this can occur. (Recall that some expressions
evaluate to an error only when the precision is increased
sufficiently.)

Test: Unit tests pass. Installed old calculator and arranged to
corrupt saved location as well as some history entries. The bad
history entries show up with an answer of "Bad Expression".
Trying th use the "Bad Expression" result no longer crashes for me.

Change-Id: I0b1a897ce018353c4b67248f84fccde82fc43e92
(cherry picked from commit 7451da4b6bb1cb40440fb755e8344f90bc38ecb5)
parent fe9f1b08
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment