summaryrefslogtreecommitdiff
path: root/connectivity
diff options
context:
space:
mode:
authorMaxim Monastirsky <momonasmon@gmail.com>2016-01-22 01:51:46 +0200
committerMaxim Monastirsky <momonasmon@gmail.com>2016-01-22 11:09:38 +0200
commit0dbe3d40579d20f4cbce3ce155996ff4b5c32c99 (patch)
tree7203a64b79e4a848c7ff4acd3922d1930679b117 /connectivity
parente39bf3677109976cae13e1bdff044e2d5769c098 (diff)
Fix wrong use of OUString::copy
Code like: if( aCommandURL.copy(5) != ".uno:" ) is obviously wrong, as OUString::copy(sal_Int32) takes the _beginning_ index, so for this condition to be false the command URL must have ".uno:" in the _middle_ of the string. This created some weird things like an empty label attribute added to any submenu item. Moreover, the command URL can be easily shorter than 5 (like when a custom submenu added by the user). Using copy(5) in such case officially considered as "undefined behavior" and will trigger an assert in debug build (that's how I discovered this code actually). Most likely the original intent was to check whether the command URL doesn't start with ".uno:", and so should be changed to use OUString::startsWith. But doing that will create a regression, as it won't be possible anymore to change labels of commands that start with ".uno:". Simply dropping this check seems to be better solution here. Change-Id: I2f88807eceae1006066a14750f2003e235f49ad4
Diffstat (limited to 'connectivity')
0 files changed, 0 insertions, 0 deletions