Website Summary Files Commits Branches @commit @diff @stats
diff options
context:
space:
mode:
Commit249bbcfbc98b219131e267d039355e55eb4b99c4 (patch)
Author
 Angel Dimitriev <angel_dimitriev@abv.bg>
2022-05-04 12:16:21 -0400
Committer
 GitHub <noreply@github.com>
2022-05-04 12:16:21 -0400
Files0d1ab2689bc97fe9632de48aa4abf64743c80431
Object-oriented_programming_FMI-249bbcfbc98b219131e267d039355e55eb4b99c4.tar
Object-oriented_programming_FMI-249bbcfbc98b219131e267d039355e55eb4b99c4.tar.gz
Object-oriented_programming_FMI-249bbcfbc98b219131e267d039355e55eb4b99c4.zip
Parent24999acfbda71f4f7f7165651230f4151c9e57fe (diff)
Update Person.cpp
1 files changed, 2 insertions, 2 deletions
-rw-r--r--Sem. 07/Person/Person.cpp4
diff --git a/Sem. 07/Person/Person.cpp b/Sem. 07/Person/Person.cpp
index eff781d..3b241c7 100644
--- a/Sem. 07/Person/Person.cpp
+++ b/Sem. 07/Person/Person.cpp
@@ -45,9 +45,9 @@ int Person::getAge() const
void Person::setName(const char* name)
{
- if (this->name == name)
+ if (name == nullptr || this->name == name)
return;
-
+
delete[] this->name;
size_t nameLen = strlen(name);
this->name = new char[nameLen + 1];