From 3ea0976a82d3e25a44247873f4421fb638c41338 Mon Sep 17 00:00:00 2001 From: Steve Brokenshire Date: Mon, 17 Jul 2017 20:23:19 +0100 Subject: [PATCH] CalendarDataStorage: Convert calendarColour to string before using c_str() in AddCalendar() and UpdateCalendar() --- .../libraries/CalendarDataStorage/CalendarDataStorage.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/source/libraries/CalendarDataStorage/CalendarDataStorage.cpp b/source/libraries/CalendarDataStorage/CalendarDataStorage.cpp index d6d335e..5842631 100644 --- a/source/libraries/CalendarDataStorage/CalendarDataStorage.cpp +++ b/source/libraries/CalendarDataStorage/CalendarDataStorage.cpp @@ -586,7 +586,8 @@ CDSCalendarResult CalendarDataStorage::AddCalendar(int accountID, string calenda return CDSCALENDAR_FAILED; } - resultCode = sqlite3_bind_text(statementHandle, 4, ((string)calendarColour).c_str(), -1, SQLITE_STATIC); + string calendarColourString = (string)calendarColour; + resultCode = sqlite3_bind_text(statementHandle, 4, calendarColourString.c_str(), -1, SQLITE_STATIC); if (resultCode != 0){ return CDSCALENDAR_FAILED; @@ -858,7 +859,8 @@ CDSCalendarResult CalendarDataStorage::UpdateCalendar(int calendarID, string cal return CDSCALENDAR_FAILED; } - resultCode = sqlite3_bind_text(statementHandle, 2, string(calendarColour).c_str(), -1, SQLITE_STATIC); + string calendarColourString = calendarColour; + resultCode = sqlite3_bind_text(statementHandle, 2, calendarColourString.c_str(), -1, SQLITE_STATIC); if (resultCode != 0){ return CDSCALENDAR_FAILED; -- 2.39.5