osx/clipboard: ensure that the string doesn't ends with null byte, otherwise it will crash.

This commit is contained in:
Mathieu Virbel 2012-06-03 12:07:44 +02:00
parent e388f71517
commit a28485e6a8
1 changed files with 3 additions and 1 deletions

View File

@ -7,7 +7,7 @@ __all__ = ('ClipboardPygame', )
from kivy.utils import platform
from . import ClipboardBase
if platform() not in ('win', 'linux'):
if platform() not in ('win', 'linux', 'macosx'):
raise SystemError('unsupported platform for pygame clipboard')
try:
@ -33,6 +33,8 @@ class ClipboardPygame(ClipboardBase):
def put(self, data, mimetype='text/plain'):
self.init()
if platform() == 'macosx' and data.endswith('\x00'):
data = data[:-1]
pygame.scrap.put(mimetype, data)
def get_types(self):