summaryrefslogtreecommitdiffstats
path: root/core/polkit-tqt-identity.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/polkit-tqt-identity.cpp')
-rw-r--r--core/polkit-tqt-identity.cpp25
1 files changed, 20 insertions, 5 deletions
diff --git a/core/polkit-tqt-identity.cpp b/core/polkit-tqt-identity.cpp
index 2649e21f5..1415d5d7f 100644
--- a/core/polkit-tqt-identity.cpp
+++ b/core/polkit-tqt-identity.cpp
@@ -42,17 +42,26 @@ class Identity::Data : public TQShared
Data(const Data &other) : identity(other.identity)
{
- g_object_ref(identity);
+ if (identity)
+ {
+ g_object_ref(identity);
+ }
}
Data(PolkitIdentity *_identity) : identity(_identity)
{
- g_object_ref(identity);
+ if (identity)
+ {
+ g_object_ref(identity);
+ }
}
~Data()
{
- g_object_unref(identity);
+ if (identity)
+ {
+ g_object_unref(identity);
+ }
}
PolkitIdentity *identity;
@@ -111,9 +120,15 @@ void Identity::setIdentity(PolkitIdentity *identity)
{
if (d->identity != identity)
{
- g_object_unref(d->identity);
+ if (d->identity)
+ {
+ g_object_unref(d->identity);
+ }
d->identity = identity;
- g_object_ref(identity);
+ if (d->identity)
+ {
+ g_object_ref(d->identity);
+ }
}
}