summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/unstable/cacheobject.h15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/unstable/cacheobject.h b/src/unstable/cacheobject.h
index 114a76f..4606493 100644
--- a/src/unstable/cacheobject.h
+++ b/src/unstable/cacheobject.h
@@ -24,6 +24,7 @@ namespace Bu
24 public: 24 public:
25 CacheObject() : 25 CacheObject() :
26 pCache( NULL ), 26 pCache( NULL ),
27 pEntry( NULL ),
27 bChanged( false ) 28 bChanged( false )
28 { 29 {
29 } 30 }
@@ -37,19 +38,23 @@ namespace Bu
37 virtual keytype getKey() const=0; 38 virtual keytype getKey() const=0;
38 virtual int getPersistenceScore() const { return 0; } 39 virtual int getPersistenceScore() const { return 0; }
39 40
40 void lock() 41 void lock() const
41 { 42 {
42 pEntry->lock(); 43 if( pEntry )
44 pEntry->lock();
43 } 45 }
44 46
45 void unlock() 47 void unlock() const
46 { 48 {
47 pEntry->unlock(); 49 if( pEntry )
50 pEntry->unlock();
48 } 51 }
49 52
50 int getRefCount() const 53 int getRefCount() const
51 { 54 {
52 return pEntry->getRefCount(); 55 if( pEntry )
56 return pEntry->getRefCount();
57 return -1;
53 } 58 }
54 59
55 bool hasChanged() const 60 bool hasChanged() const