Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Donald Haase
Cockatrice
Commits
7e63f44c
Commit
7e63f44c
authored
Dec 12, 2015
by
ctrlaltca
Browse files
Merge pull request #1700 from ctrlaltca/fix_1675
Avoid crash on dereferencing null pointer
parents
0286cd3d
deec7cdc
Changes
1
Hide whitespace changes
Inline
Side-by-side
cockatrice/src/player.cpp
View file @
7e63f44c
...
@@ -2115,6 +2115,9 @@ void Player::actSetPT()
...
@@ -2115,6 +2115,9 @@ void Player::actSetPT()
void
Player
::
actDrawArrow
()
void
Player
::
actDrawArrow
()
{
{
if
(
!
game
->
getActiveCard
())
return
;
game
->
getActiveCard
()
->
drawArrow
(
Qt
::
red
);
game
->
getActiveCard
()
->
drawArrow
(
Qt
::
red
);
}
}
...
@@ -2183,6 +2186,9 @@ void Player::actSetAnnotation()
...
@@ -2183,6 +2186,9 @@ void Player::actSetAnnotation()
void
Player
::
actAttach
()
void
Player
::
actAttach
()
{
{
if
(
!
game
->
getActiveCard
())
return
;
ArrowAttachItem
*
arrow
=
new
ArrowAttachItem
(
game
->
getActiveCard
());
ArrowAttachItem
*
arrow
=
new
ArrowAttachItem
(
game
->
getActiveCard
());
scene
()
->
addItem
(
arrow
);
scene
()
->
addItem
(
arrow
);
arrow
->
grabMouse
();
arrow
->
grabMouse
();
...
@@ -2190,6 +2196,9 @@ void Player::actAttach()
...
@@ -2190,6 +2196,9 @@ void Player::actAttach()
void
Player
::
actUnattach
()
void
Player
::
actUnattach
()
{
{
if
(
!
game
->
getActiveCard
())
return
;
Command_AttachCard
cmd
;
Command_AttachCard
cmd
;
cmd
.
set_start_zone
(
game
->
getActiveCard
()
->
getZone
()
->
getName
().
toStdString
());
cmd
.
set_start_zone
(
game
->
getActiveCard
()
->
getZone
()
->
getName
().
toStdString
());
cmd
.
set_card_id
(
game
->
getActiveCard
()
->
getId
());
cmd
.
set_card_id
(
game
->
getActiveCard
()
->
getId
());
...
@@ -2268,16 +2277,25 @@ void Player::actCardCounterTrigger()
...
@@ -2268,16 +2277,25 @@ void Player::actCardCounterTrigger()
void
Player
::
actPlay
()
void
Player
::
actPlay
()
{
{
if
(
!
game
->
getActiveCard
())
return
;
playCard
(
game
->
getActiveCard
(),
false
,
game
->
getActiveCard
()
->
getInfo
()
->
getCipt
());
playCard
(
game
->
getActiveCard
(),
false
,
game
->
getActiveCard
()
->
getInfo
()
->
getCipt
());
}
}
void
Player
::
actHide
()
void
Player
::
actHide
()
{
{
if
(
!
game
->
getActiveCard
())
return
;
game
->
getActiveCard
()
->
getZone
()
->
removeCard
(
game
->
getActiveCard
());
game
->
getActiveCard
()
->
getZone
()
->
removeCard
(
game
->
getActiveCard
());
}
}
void
Player
::
actPlayFacedown
()
void
Player
::
actPlayFacedown
()
{
{
if
(
!
game
->
getActiveCard
())
return
;
playCard
(
game
->
getActiveCard
(),
true
,
false
);
playCard
(
game
->
getActiveCard
(),
true
,
false
);
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment