Commit 88e1ad8a authored by Harald Sitter's avatar Harald Sitter 💣

do not presume all storageaccess are also volumes

the device.as()-> would potentially dereference a nullptr

notably I have a fstab entry for a cifs mount. that is a NetworkShare
and a StorageAccess but not a StorageVolume
parent 936a461d
/*
Copyright (c) 2020 David Redondo <kde@david-redondo.de>
Copyright (c) 2020 Harald Sitter <sitter@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
......@@ -187,8 +188,9 @@ DisksPlugin::~DisksPlugin()
void DisksPlugin::addDevice(const Solid::Device& device)
{
auto container = containers()[0];
const auto volume = device.as<Solid::StorageVolume>();
auto access = device.as<Solid::StorageAccess>();
if (!access || device.as<Solid::StorageVolume>()->isIgnored()) {
if (!access || !volume || volume->isIgnored()) {
return;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment