Skip to content

Commit

Permalink
Merge pull request #15 from Rodmg/experimental
Browse files Browse the repository at this point in the history
Fix crash on Bluetooth functionality
  • Loading branch information
Rodmg authored Dec 20, 2024
2 parents 00a5a60 + 4fa82c3 commit c15e7c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion debian/changelog
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ linamp (1.3.0) bookworm; urgency=medium

* Feature: Bluetooth Source, use Linamp as a Bluetooth audio receiver

-- Rodrigo Méndez <[email protected]> Tue, 17 Dec 2024 22:37:00 -0600
-- Rodrigo Méndez <[email protected]> Tue, 20 Dec 2024 22:37:00 -0600

linamp (1.2.1) bookworm; urgency=medium

Expand Down
10 changes: 5 additions & 5 deletions src/audiosourcebluetooth/audiosourcebluetooth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ bool AudioSourceBluetooth::doPollEvents()
auto state = PyGILState_Ensure();
PyObject* pyChangeDetected = PyObject_CallMethod(player, "poll_events", NULL);

if(PyBool_Check(pyChangeDetected)) {
if(pyChangeDetected != nullptr && PyBool_Check(pyChangeDetected)) {
changeDetected = PyObject_IsTrue(pyChangeDetected);
#ifdef DEBUG_ASPY
qDebug() << ">>>Change detected?:" << changeDetected;
Expand Down Expand Up @@ -320,19 +320,19 @@ void AudioSourceBluetooth::refreshStatus(bool shouldRefreshTrackInfo)

// Get shuffle status
PyObject *pyShuffleEnabled = PyObject_CallMethod(player, "get_shuffle", NULL);
if(PyBool_Check(pyShuffleEnabled)) {
if(pyShuffleEnabled != nullptr && PyBool_Check(pyShuffleEnabled)) {
this->isShuffleEnabled = PyObject_IsTrue(pyShuffleEnabled);
emit shuffleEnabledChanged(this->isShuffleEnabled);
}
Py_DECREF(pyShuffleEnabled);
if(pyShuffleEnabled) Py_DECREF(pyShuffleEnabled);

// Get repeat status
PyObject *pyRepeatEnabled = PyObject_CallMethod(player, "get_repeat", NULL);
if(PyBool_Check(pyRepeatEnabled)) {
if(pyRepeatEnabled != nullptr && PyBool_Check(pyRepeatEnabled)) {
this->isRepeatEnabled = PyObject_IsTrue(pyRepeatEnabled);
emit repeatEnabledChanged(this->isRepeatEnabled);
}
Py_DECREF(pyRepeatEnabled);
if(pyRepeatEnabled) Py_DECREF(pyRepeatEnabled);

PyObject *pyStatus = PyObject_CallMethod(player, "get_status", NULL);
if(pyStatus == nullptr) {
Expand Down

0 comments on commit c15e7c0

Please sign in to comment.