renderer: prevent cache saving/loading with empty path
This commit is contained in:
@@ -197,6 +197,11 @@ bool FrameHashCache::SaveCacheFrame(const QByteArray &hash, FramePtr frame) cons
|
||||
|
||||
bool FrameHashCache::SaveCacheFrame(const QString &cache_path, const QByteArray &hash, char *data, const VideoParams &vparam, int linesize_bytes)
|
||||
{
|
||||
if (cache_path.isEmpty()) {
|
||||
qWarning() << "Failed to save cache frame with empty path";
|
||||
return false;
|
||||
}
|
||||
|
||||
QString fn = CachePathName(cache_path, hash);
|
||||
|
||||
if (SaveCacheFrame(fn, data, vparam, linesize_bytes)) {
|
||||
@@ -226,6 +231,11 @@ bool FrameHashCache::SaveCacheFrame(const QString &cache_path, const QByteArray
|
||||
|
||||
FramePtr FrameHashCache::LoadCacheFrame(const QString &cache_path, const QByteArray &hash)
|
||||
{
|
||||
if (cache_path.isEmpty()) {
|
||||
qWarning() << "Failed to save cache frame with empty path";
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return LoadCacheFrame(CachePathName(cache_path, hash));
|
||||
}
|
||||
|
||||
|
||||
@@ -545,8 +545,12 @@ bool RenderProcessor::CanCacheFrames()
|
||||
|
||||
QVariant RenderProcessor::GetCachedTexture(const QByteArray& hash)
|
||||
{
|
||||
VideoParams video_params = GetCacheVideoParams();
|
||||
QString cache_dir = ticket_->property("cache").toString();
|
||||
if (cache_dir.isEmpty()) {
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
VideoParams video_params = GetCacheVideoParams();
|
||||
|
||||
FramePtr f = FrameHashCache::LoadCacheFrame(cache_dir, hash);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user