aboutsummaryrefslogtreecommitdiffstats
path: root/common/rfb
diff options
context:
space:
mode:
Diffstat (limited to 'common/rfb')
-rw-r--r--common/rfb/SConnection.cxx4
-rw-r--r--common/rfb/VNCSConnectionST.cxx6
2 files changed, 5 insertions, 5 deletions
diff --git a/common/rfb/SConnection.cxx b/common/rfb/SConnection.cxx
index b6c20923..e5d40e9d 100644
--- a/common/rfb/SConnection.cxx
+++ b/common/rfb/SConnection.cxx
@@ -23,7 +23,6 @@
#include <stdio.h>
#include <string.h>
-#include <assert.h>
#include <rfb/Exception.h>
#include <rfb/Security.h>
#include <rfb/clipboardTypes.h>
@@ -348,7 +347,8 @@ void SConnection::setAccessRights(AccessRights ar)
bool SConnection::accessCheck(AccessRights ar) const
{
- assert(state_ >= RFBSTATE_QUERYING);
+ if (state_ < RFBSTATE_QUERYING)
+ throw Exception("SConnection::accessCheck: invalid state");
return (accessRights & ar) == ar;
}
diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx
index 97fa69cb..5d047e6a 100644
--- a/common/rfb/VNCSConnectionST.cxx
+++ b/common/rfb/VNCSConnectionST.cxx
@@ -316,9 +316,9 @@ void VNCSConnectionST::setLEDStateOrClose(unsigned int state)
void VNCSConnectionST::requestClipboardOrClose()
{
try {
+ if (state() != RFBSTATE_NORMAL) return;
if (!accessCheck(AccessCutText)) return;
if (!rfb::Server::acceptCutText) return;
- if (state() != RFBSTATE_NORMAL) return;
requestClipboard();
} catch(rdr::Exception& e) {
close(e.str());
@@ -328,9 +328,9 @@ void VNCSConnectionST::requestClipboardOrClose()
void VNCSConnectionST::announceClipboardOrClose(bool available)
{
try {
+ if (state() != RFBSTATE_NORMAL) return;
if (!accessCheck(AccessCutText)) return;
if (!rfb::Server::sendCutText) return;
- if (state() != RFBSTATE_NORMAL) return;
announceClipboard(available);
} catch(rdr::Exception& e) {
close(e.str());
@@ -340,9 +340,9 @@ void VNCSConnectionST::announceClipboardOrClose(bool available)
void VNCSConnectionST::sendClipboardDataOrClose(const char* data)
{
try {
+ if (state() != RFBSTATE_NORMAL) return;
if (!accessCheck(AccessCutText)) return;
if (!rfb::Server::sendCutText) return;
- if (state() != RFBSTATE_NORMAL) return;
sendClipboardData(data);
} catch(rdr::Exception& e) {
close(e.str());