item_updater: Fix crash in updateUbootEnvVars()

In 25773a7 there is a change in updateUbootEnvVars() to use
versions.find(versionId)->second->path() as the flashId to update.

However, the function may be called with an invalid versionId, e.g. if
the BMC has only one activation for static layout, resetUbootEnvVars()
will not find a valid `lowestPriorityVersion`, and it will pass an empty
string to `updateUbootEnvVars()`.

Fix the issue by adding a check and return if there is no such version
found.

Tested: Verify the BMC code update for static layout with one flash is
        OK.

Signed-off-by: Lei YU <yulei.sh@bytedance.com>
Change-Id: I4bf8240fefca3ae919024a61e45cfe3d29ed01e7
1 file changed