From da7400ef5c62ee144fc14ba7ca4745349f0b0c72 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Wed, 26 Jun 2013 23:56:43 +0900 Subject: Return std::unique_ptr member as const ref Returning raw pointer has a risk that it may be stolen by std::shared_ptr in accident. --- src/UTMetadataPostDownloadHandler.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/UTMetadataPostDownloadHandler.cc') diff --git a/src/UTMetadataPostDownloadHandler.cc b/src/UTMetadataPostDownloadHandler.cc index 82084243..58e3002a 100644 --- a/src/UTMetadataPostDownloadHandler.cc +++ b/src/UTMetadataPostDownloadHandler.cc @@ -59,8 +59,7 @@ bool UTMetadataPostDownloadHandler::Criteria::match const std::shared_ptr& dctx = requestGroup->getDownloadContext(); if(dctx->hasAttribute(CTX_ATTR_BT)) { - auto attrs = bittorrent::getTorrentAttrs(dctx); - if(attrs->metadata.empty()) { + if(bittorrent::getTorrentAttrs(dctx)->metadata.empty()) { return true; } } -- cgit