From 3d8df21c1d749ca5188ee5c458c479c23402c153 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sl=C3=A1vek=20Banko?= Date: Fri, 27 Sep 2024 14:26:22 +0200 Subject: [PATCH] tdeio - scheduler: Fix crash if the job or slave are not valid. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Slávek Banko (cherry picked from commit e22af1c0a03ce2cb14b051edfc8ee11b31896341) --- tdeio/tdeio/scheduler.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tdeio/tdeio/scheduler.cpp b/tdeio/tdeio/scheduler.cpp index 30c2d8375..abc631284 100644 --- a/tdeio/tdeio/scheduler.cpp +++ b/tdeio/tdeio/scheduler.cpp @@ -796,6 +796,18 @@ Scheduler::_assignJobToSlave(TDEIO::Slave *slave, SimpleJob *job) { // kdDebug(7006) << "_assignJobToSlave( " << job << ", " << slave << ")" << endl; TQString dummy; + if (!job) + { + kdDebug(7006) << "_assignJobToSlave(): ERROR, non-existing job." << endl; + return false; + } + if (!slave) + { + kdDebug(7006) << "_assignJobToSlave(): ERROR, non-existing slave." << endl; + job->kill(); + return false; + } + if ((slave->slaveProtocol() != KProtocolManager::slaveProtocol( job->url(), dummy )) || (!newJobs.removeRef(job)))