mirror of
https://git.proxmox.com/git/fwupd
synced 2025-08-02 22:03:48 +00:00
trivial: Return a more invalid value if FWUPD_IS_DEVICE() fails
We don't want to return something that's actually the initial value.
This commit is contained in:
parent
ac3f7f5521
commit
74e9b04b39
@ -1284,7 +1284,7 @@ guint32
|
||||
fwupd_device_get_battery_level(FwupdDevice *self)
|
||||
{
|
||||
FwupdDevicePrivate *priv = GET_PRIVATE(self);
|
||||
g_return_val_if_fail(FWUPD_IS_DEVICE(self), FWUPD_BATTERY_LEVEL_INVALID);
|
||||
g_return_val_if_fail(FWUPD_IS_DEVICE(self), G_MAXUINT);
|
||||
return priv->battery_level;
|
||||
}
|
||||
|
||||
|
@ -3558,7 +3558,7 @@ fu_device_ensure_battery_inhibit(FuDevice *self)
|
||||
guint
|
||||
fu_device_get_battery_level(FuDevice *self)
|
||||
{
|
||||
g_return_val_if_fail(FU_IS_DEVICE(self), FWUPD_BATTERY_LEVEL_INVALID);
|
||||
g_return_val_if_fail(FU_IS_DEVICE(self), G_MAXUINT);
|
||||
|
||||
/* use the parent if the child is unset */
|
||||
if (fu_device_has_internal_flag(self, FU_DEVICE_INTERNAL_FLAG_USE_PARENT_FOR_BATTERY) &&
|
||||
|
Loading…
Reference in New Issue
Block a user