mirror of
https://github.com/mpv-player/mpv
synced 2025-01-18 04:51:52 +00:00
client API: qthelper: return NULL as handle if unset
Creating a plain Handle() should yield a NULL mpv_handle. Also, remove the redundant non-const definition of the conversion operator. At least in this situation it's not needed. Also, add include guards around qthelper.hpp.
This commit is contained in:
parent
628f1dcb42
commit
799e8861bb
@ -19,6 +19,9 @@
|
||||
* for other languages.
|
||||
*/
|
||||
|
||||
#ifndef MPV_CLIENT_API_QTHELPER_H_
|
||||
#define MPV_CLIENT_API_QTHELPER_H_
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include <QVariant>
|
||||
@ -57,8 +60,7 @@ public:
|
||||
}
|
||||
|
||||
// Return the raw handle; for use with the libmpv C API.
|
||||
operator mpv_handle*() { return (*sptr).mpv; }
|
||||
operator mpv_handle*() const { return (*sptr).mpv; }
|
||||
operator mpv_handle*() const { return sptr ? (*sptr).mpv : 0; }
|
||||
};
|
||||
|
||||
static inline QVariant node_to_variant(const mpv_node *node)
|
||||
@ -272,3 +274,5 @@ static inline QVariant command_variant(mpv_handle *ctx, const QVariant &args)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user